Used to format the time of a datetime
, date
or time
object.
Variable
moon_landing = datetime.datetime(year=1969, month=7, day=21, hour=2, minute=56, second=15, tzinfo=datetime.timezone.utc)
Sample Formats
{{ moon_landing }}
– July 21, 1969, 2:56 a.m.{{ moon_landing|time }}
– 2:56 a.m.{{ moon_landing|time:'G:i:s'}}
– 02:56:15 a.m.
Commentary
If you want output both the date and time, use the
date
filter instead.