Formatting dates

From Planfix
Revision as of 08:28, 2 September 2022 by Aliona (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Different variables can be used in Planfix task and document templates, including date and time variables. You can set the desired display format for these variables. The template for a variable with formatting looks as follows:

{{{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.


Go To