Template Filter - time
Definition and Usage
The time
filter formats and return the time
from a datetime object.
You can specify the format by using these format characters:
g | Hour (1-12) |
G | Hour (0-23) |
h | Hour (01-12) |
H | Hour (00-23) |
i | Minutes (00-59) |
s | Seconds (00-59) |
u | Microseconds (000000-999999) |
a | am/pm suffix (a.m. or p.m.) |
A | AM/PM suffix (A.M. or P.M.) |
f | Time, hour and minute, but minutes are left out if they are 0 |
P | Same as f, but also including a.m. or p.m. and: If time is exactly "12:00 a.m." it returns "midnight". If time is exactly "12:00 p.m." it returns "noon". |
Syntax
{{ datetime|time:"format" }}
Template filters are defined by using a pipe |
character followed by the name of the filter.
Arguments are defined by using a colon :
character followed by the argument value.
Arguments
Value | Description |
---|---|
format | Optional. The format you want to return the time in. Default value TIME_FORMAT, which will be the same as "H:i".. |