• Products
  • Documentation
  • Resources

Custom date formatting

For charts with date or datetime axes, Atlassian Analytics has pre-defined formats that you can choose from to display those dates and times in your chart’s axis labels. If you don’t see a pre-defined option that meets your needs, you can provide a custom date format to use in your chart’s axis labels. Custom date formats let you specify the exact way you want to display your date labels in the chart.

To use a custom date format:

  1. Open the chart settings of the chart.

  2. Go to the Axis tab.

  3. For Date format of your date axis, select Custom.

  4. Provide a format string using any of the format directives listed below. The default format string is %Y-%m-%d.

Atlassian Analytics uses the d3-time-format module to power its custom date formatting. View the d3 Github documentation for all available formatting options.

Applying a custom date format of '%m/%d/%Y' to show month, day, then year.

Examples of format strings

Use any of these common format strings for your custom date format:

  • %m/%d/%Y separates the month, day, and year by a forward slash (/)—for example, 01/31/2022.

  • Q%q shows the quarters as Q1, Q2, Q3, or Q4.

  • %-m/%-d shows month and day without prepended 0s. For example, January 2nd would show as 1/2.

  • %b %_d, %y shows dates as Feb 4, 22 for example.

  • %d.%m.%y separates the day, month, and year by a period (.)—for example, 31.01.2022. Switch the order around and notation for a Spanish date system.

Available format directives

Directives return the desired part of a date or timestamp. Use a combination of static text and any of the following directives to create your custom format string:

Dates

Part of date

Directive

Example output

Abbreviated weekday names

%a

Sun, Mon, Tue, Wed, Thu, Fri, Sat

Full weekday names

%A

Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday

Weekdays as numbers (Sunday-based)

%w

0, 1, …, 6

Weekdays as numbers (ISO 8601 Monday-based)

%u

1, 2, …, 7

Zero-padded days

%d

01, 02, …, 31

Space-padded days

%e

1, 2, …, 31

Abbreviated month names

%b

Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec

Full month names

%B

January, February, March, April, May, June, July, August, September, October, November, December

Months as numbers

%m

01, 02, …, 12

Years with the century

%Y

2000, 2001, 2002, and so on

Years without the century

%y

00, 01, …, 99

Weeks of the year (Sunday-based)

%U

00, 01, … 53

Note that all days in a new year preceding the first Sunday are considered to be in week 0.

Weeks of the year (Monday-based)

 

%W

00, 01, … 53

Note that all days in a new year preceding the first Monday are considered to be in week 0.

Day of the year

%j

001, 002, … 366

Quarter of the year

%q

1, 2, 3, or 4


Times

Part of time

Directive

Example output

24-hour clock

%H

0, 1, …, 23

12-hour clock

%I

1, 2, … 12

Minutes

%M

00, 01, … 59

Seconds

%S

00, 01, …, 61

Note that the range for seconds goes up to 61 rather than 59 to allow for the occasional leap second and double leap sound.

Milliseconds

%L

000, 001, … 999

a.m. or p.m.

%p

AM or PM

Milliseconds since UNIX epoch

%Q

1230796800000

Seconds since UNIX epoch

%s

1230796800

 

Additional Help