Article contents
The basics #
ListoWP uses two date formats when displaying a Task due date: short and long.
- Short format is used to display a date which falls on the current calendar year.
- The default is
M j
which translates to (for example) May 4
- The default is
- Long format is used for dates falling on any other year (past and future)
- The default is
M j, Y
which translates to (for example) May 4, 1986
- The default is
You are free to modify these date formats to ones that fit your use case best. First of all, date format is often a regional preference. You might also want full dates at all times, perhaps even including the time. Or maybe dates outside of the current year only to mention month & year without the day.
Examples #
We use standard PHP formatting to display the dates. You can use characters like dots, dashes, commas to format the date further.
F j, Y
for standard “natural language” date = May 4, 1986F j
same as above but without year = May 4- For languages other than English the order may be different. In Polish it would be
j F Y
= 4 maja 1986
F jS, Y
for more grammatically verbatim version = May 4th, 1986F jS
same as above but without year = May 4th
Y/m/d
for YYYY/mm/dd standard = 1986/05/04d-m-Y
for dd/mm/YYY standard = 04-05-1986- To display a letter verbatim instead of being transformed as a format, prefix it with a backslash like this:
jS \d\a\y \o\f F
= 4th day of May
Available formatting options #
Character | Description | Example returned values |
---|---|---|
Day | — | — |
d | Day of the month, 2 digits with leading zeros | 01 to 31 |
D | A textual representation of a day, three letters | Mon through Sun |
j | Day of the month without leading zeros | 1 to 31 |
l (lowercase ‘L’) | A full textual representation of the day of the week | Sunday through Saturday |
S | English ordinal suffix for the day of the month, 2 characters | st , nd , rd or th . Works well with j |
Month | — | — |
F | A full textual representation of a month, such as January or March | January through December |
m | Numeric representation of a month, with leading zeros | 01 through 12 |
M | A short textual representation of a month, three letters | Jan through Dec |
n | Numeric representation of a month, without leading zeros | 1 through 12 |
Year | ||
Y | A full numeric representation of a year, at least 4 digits, with - for years BCE. | Examples: 1999 , 2003 , 2030 |
y | A two digit representation of a year | Examples: 99 or 03 |
Time | ||
a | Lowercase Ante meridiem and Post meridiem | am or pm |
A | Uppercase Ante meridiem and Post meridiem | AM or PM |
g | 12-hour format of an hour without leading zeros | 1 through 12 |
G | 24-hour format of an hour without leading zeros | 0 through 23 |
h | 12-hour format of an hour with leading zeros | 01 through 12 |
H | 24-hour format of an hour with leading zeros | 00 through 23 |
i | Minutes with leading zeros | 00 to 59 |
s | Seconds with leading zeros | 00 through 59 |