Formatting dates: Difference between revisions
From Planfix
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
}} | }} | ||
'''<nowiki>{{{Task.Date::FormatDate=Format}}</nowiki>''', where Format is the date formatting template. | '''<nowiki>{{{Task.Date::FormatDate=Format}}</nowiki>''', where Format is the date formatting template. | ||
Using the date July 3, 1996 at 2:14 PM as an example, the tables below provide patterns for formatting dates in variables. | Using the date July 3, 1996 at 2:14 PM as an example, the tables below provide patterns for formatting dates in variables. | ||
Line 168: | Line 167: | ||
|Wednesday, 02 PM | |Wednesday, 02 PM | ||
|} | |} | ||
== Important == | == Important == | ||
*Date formats in variables are specified using English words and letters. | *Date formats in variables are specified using English words and letters. |
Revision as of 12:02, 18 December 2024
{{{Task.Date::FormatDate=Format}}, where Format is the date formatting template.
Using the date July 3, 1996 at 2:14 PM as an example, the tables below provide patterns for formatting dates in variables.
Format | Description | Examples |
y | year (4 digits) | 1996 |
yy | year (2 digits) | 96 |
yyyy | year (4 digits) | 1996 |
M | month without leading zero | 7, 10 |
MM | month with leading zero | 07, 10 |
MMM | abbreviated month | Jul. |
MMMM | full month name | July |
d | day of the month without leading zero | 3, 15 |
dd | day of the month with leading zero | 03, 15 |
E | Abbreviated day of the week | Wed. |
EEEE | Full day of the week | Wednesday |
a | AM / PM | PM |
H | month in 24-hour format without leading zero | 3, 14 |
HH | чmonth in 24-hour format with leading zero | 03, 14 |
h | hour in 12-hour format | 2 |
hh | hour in 12-hour format | 02 |
m | minutes without leading zero | 4, 30 |
mm | minutes with leading zero | 04, 30 |
s | seconds | 5, 55 |
ss | seconds with leading zero | 05, 55 |
S | milliseconds (1 digit) | 3 |
SS | milliseconds (2 digits) | 35 |
SSS | milliseconds (3 digits) | 359 |
L | month without leading zero | 7 |
LL | month with leading zero | 07 |
LLL | month name | July |
w | week number in year | 27 |
W | week number in month | 1 |
D | day of the year | 185 |
Examples
The table below shows an example using a custom date field.
Variable | Result |
{{Task.Date::FormatDate=dd/MM/yy}} | 03/06/96 |
{{Task.Date::FormatDate=dd MMM yyyy}} | 03 Jul. 1996 |
{{Task.Date::FormatDate=yyyy-MM-dd}} | 1996-06-03 |
{{Task.Date::FormatDate=dd-MM-yyyy h:mm a}} | 03-06-1996 2:14 AM |
{{Task.Date::FormatDate=dd-MM-yyyy HH:mm:ss}} | 03-06-1996 14:14:28 |
{{{Task.Date::FormatDate=yyyy-MM-dd HH:mm:ss.SSS}} | 1996-06-03 14:14:28.954 |
{{Task.Date::FormatDate=yyMMddHHmmssSSS}} | 960603141428954 |
{{Task.Date::FormatDate=EEEE, hh a}} | Wednesday, 02 PM |
Important
- Date formats in variables are specified using English words and letters.
- When pasting a date variable with formatting in an Excel spreadsheet, formatting is applied. If there's no formatting for the variable, the formatting set for the cell will be used. Cells where formatting is pasted will be changed to date type.