MCPcopy
hub / github.com/django/django / time

Function time

django/template/defaultfilters.py:799–809  ·  view source on GitHub ↗

Format a time according to the given format.

(value, arg=None)

Source from the content-addressed store, hash-verified

797
798@register.filter(expects_localtime=True, is_safe=False)
799def time(value, arg=None):
800 """Format a time according to the given format."""
801 if value in (None, ""):
802 return ""
803 try:
804 return formats.time_format(value, arg)
805 except (AttributeError, TypeError):
806 try:
807 return time_format(value, arg)
808 except (AttributeError, TypeError):
809 return ""
810
811
812@register.filter("timesince", is_safe=False)

Callers 15

valueMethod · 0.85
new_format_sqlMethod · 0.85
test_parse_timeMethod · 0.85
test_am_pmMethod · 0.85
test_timezonesMethod · 0.85
test_P_formatMethod · 0.85
test_render_valueMethod · 0.85
test_formatMethod · 0.85
test_l10nMethod · 0.85
test_timeFieldMethod · 0.85

Calls 1

time_formatFunction · 0.90

Tested by 15

new_format_sqlMethod · 0.68
test_parse_timeMethod · 0.68
test_am_pmMethod · 0.68
test_timezonesMethod · 0.68
test_P_formatMethod · 0.68
test_render_valueMethod · 0.68
test_formatMethod · 0.68
test_l10nMethod · 0.68
test_timeFieldMethod · 0.68