Usage examples
| Formula | Result | Description |
|---|---|---|
| {[Y]} | 2023 | Current year |
| {[m/y]} | 04/23 | Current month and year in short format |
| {[d F Y]} | 18 April 2023 | Displaying a specific date in full format |
| {[d F Y] first day of next month} | 01 May 2023 | First day of the month following the current one |
| {[d F Y] first monday} | 24 April 2023 | Next Monday |
| {[F Y] +3 month} | July 2023 | Month and year three months from the current date |
| {[d-m-y] last day of this month} | 30-04-23 | Last day of the current month in short format |
Date formats
Character in the format string |
Description | Example of returned value |
|---|---|---|
| Day | --- | --- |
d |
Day of the month, 2 digits with leading zero | from 01 to 31 |
D |
Textual representation of the day of the week, 3 characters | from Mon to Sun |
j |
Day of the month without leading zero | from 1 to 31 |
l (lowercase 'L') |
Full name of the day of the week | from Sunday to Saturday |
N |
Day of the week as a number according to ISO 8601 | from 1 (Monday) to 7 (Sunday) |
S |
English ordinal suffix for the day of the month, 2 characters |
st, nd, rd or
th. Used in combination with j
|
w |
Day of the week as a number | from 0 (Sunday) to 6 (Saturday) |
z |
Day of the year (starting from 0) | from 0 to 365 |
| Week | --- | --- |
W |
ISO 8601 week number of the year; weeks start on Monday | For example: 42 (42nd week of the year) |
| Month | --- | --- |
F |
Full month name, for example, January or March | from January to December |
m |
Month number with leading zero | from 01 to 12 |
M |
Abbreviated month name, 3 characters | from Jan to Dec |
n |
Month number without leading zero | from 1 to 12 |
t |
Number of days in the given month | from 28 to 31 |
| Year | --- | --- |
L |
Leap year indicator | 1 if leap year, otherwise 0. |
o |
ISO 8601 year number. Works like Y, except when the ISO week number (W) belongs to the previous or next year; in such case, the year of that week is used. |
Examples: 1999 or 2003 |
X |
Extended full numeric representation of the year, at least 4 digits, with - for years BCE and + for years CE.
|
Examples: -0055, +0787,
+1999, +10191
|
x |
Extended full numeric representation if required, or standard full numeric representation if possible (like Y). At least four digits. For years BCE, prefix is -.
For years from (and including) 10000, prefix is +.
|
Examples: -0055, 0787,
1999, +10191
|
Y |
Full numeric representation of the year, at least 4 digits, with - for years BCE |
Examples: -0055, 0787,
1999, 2003,
10191.
|
y |
Year number, 2 digits | Examples: 99, 03 |
Modifiers
| Description | Format |
|---|---|
dayname (day of the week name) |
'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' |
daytext (week intervals) |
'weekday' | 'weekdays' |
number |
[+-]?[0-9]+ |
ordinal (ordinal numbers and indicators) |
'first' | 'second' | 'third' | 'fourth' | 'fifth' | 'sixth' | 'seventh' | 'eighth' | 'ninth' | 'tenth' | 'eleventh' | 'twelfth' | 'next' | 'last' | 'previous' | 'this' |
reltext (indicators) |
'next' | 'last' | 'previous' | 'this' |
space (space and tab characters) |
[ \t]+ |
unit (intervals) |
'ms' | 'µs' | (( 'msec' | 'millisecond' | 'µsec' | 'microsecond'
| 'usec' | 'sec' | 'second' | 'min' | 'minute' | 'hour' | 'day' |
'fortnight' | 'forthnight' | 'month' | 'year') 's'?) | 'weeks' |
daytext
|
| Format | Description | Examples |
|---|---|---|
| 'yesterday' | Midnight yesterday | "yesterday 14:00" |
| 'midnight' | Time set to 00:00:00 | |
| 'today' | Time set to 00:00:00 | |
| 'now' | Current time | |
| 'noon' | Time set to 12:00:00 | "yesterday noon" |
| 'tomorrow' | Midnight tomorrow | |
'back of' hour |
15 minutes past the specified hour | "back of 7pm", "back of 15" |
'front of' hour |
15 minutes before the specified hour | "front of 5am", "front of 23" |
| 'first day of' | Sets the first day of the current month. Usually this notation works better when combined with a month name following it; otherwise, the current month is assumed. | "first day of January 2008" |
| 'last day of' | Sets the last day of the current month. Usually this notation works better when combined with a month name following it; otherwise, the current month is assumed. | "last day of next month" |
ordinal space dayname space 'of' |
Calculates the x occurrence of a weekday in the current or specified month. |
"first sat of July 2008" |
'last' space dayname space 'of' |
Calculates the last occurrence of a weekday in the current or specified month. | "last sat of July 2008" |
number space? (unit | 'week') |
Calculates relative time using numeric period values. | "+5 weeks", "12 day", "-7 weekdays" |
ordinal space unit |
Calculates relative time using string period values. | "fifth day", "second month" |
| 'ago' | Subtracts all values from the last obtained timestamp. | "2 days ago", "8 days ago 14:00", "2 months 5 days ago", "2 months ago 5 days", "2 days ago ago" |
dayname |
Moves to the next occurrence of the specified weekday | "Monday" |
reltext space 'week' |
Parses the format "weekday + last/this/next week". | "Monday next week" |




