Supported Custom Datetime Formats
  • 30 Sep 2022
  • 2 Minutes to read
  • Contributors

Supported Custom Datetime Formats


Article Summary

Overview

Date formats have the potential to be confusing, especially if you are working across multiple countries with different localisations and standards. To help avoid this, Tulip allows administrators to set a custom Datetime format for your site. Once it is set, every date or time across the entire product will use the new format you set.

Tulip provides a list of our customers' most common choices in a dropdown. For date, we provide a numeric option and a non-numeric option. The numeric option uses 0 padding and can have either day or month first. The non-numeric option uses the first 3 letters of the name of the month, making this option compact yet unambiguous.

Administrators can choose a separator of their choice from dash "-", slash "/", and period "." depending on their region or preference.

Finally, for time we allow for a 24-hour clock or a 12-hour clock. The 12-hour clock will always show AM/PM, so it should be unambiguous.

Freeform Option

If you would like an option not provided in the dropdown, you may also specify a completely freeform format. To use freeform mode, click the checkbox, then type in the desired format using letters as placeholders for the actual data. For example, ISO 8601 would be written YYYY-MM-DD for date and HH:mm:ss Z for time. For a full list of supported symbols, see below.

Note: Letters not included here are not supported and might give unexpected behavior. Letters are case sensitive. Non-alphabetic characters will be interpreted literally, allowing you to add separators such as space " ", dash "-", slash "/", period ".", and colon ":"

Date (common)

Year

YY   |   01 ... 99  
YYYY | 2001 ... 2099

Month

M    |       1 ... 12  
MM   |      01 ... 12  
MMM  |     Jan ... Dec  
MMMM | January ... December

Day of Month

D  |  1 ... 31  
DD | 01 ... 31

Day of Week

dd   |     Su ... Sa  
ddd  |    Sun ... Sat  
dddd | Sunday ... Saturday

Quarter

Q | 1 ... 4

Week of Year

w  |  1 ... 53  
ww | 01 ... 53

Time

Hour

h  |  1 ... 12  
hh | 01 ... 12  
H  |  0 ... 23  
HH | 00 ... 23  
k  |  1 ... 24  
kk | 01 ... 24

Minute

m  |  0 ... 59  
mm | 01 ... 59

Second

s  |  0 ... 59  
ss | 00 ... 59

Fractional Second

S    |    0 ... 9  
SS   |   00 ... 99  
SSS  |  000 ... 999  
SSSS | 0000 ... 9999  
...and so on

AM/PM

A | AM ... PM  
a | am ... pm

Time Zone

Z  | -07:00 ... +07:00  
ZZ |  -0700 ... +0700

Unsupported Characters

Do not use the character "g" or "G". In the past, this character has caused subtle errors which caused the year to occasionally display incorrectly. Because of this, "g" and "G" will now cause the page to crash if you use them.


Was this article helpful?