The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dotiac::DTL::Tag::now - The {% now FORMAT %} tag

SYNOPSIS

Template file:

        {% now "d. o\f F Y \a\t P %} {# 03. of May 1999 at 12:30 a.m. #}

DESCRIPTION

        Gives the current time and a specific FORMAT to the date filter (See L<Dotiac::DTL::Filter>). This will result in the current time being formatted according to the specified FORMAT.

Format options

You can combine as many of these as you like or need:

        {% now "d. b." %}
"\"

Returns the next character, regardless if it is a format character or not.

        {% now "\H\e\l\l\o \W\o\r\l\d" %} {# =Hello World #}

This also means "\n" will in this case render an "n" and NOT a newline. Same for "\t","\f","\b","\r".

"a"

Returns whether it is AM or PM in Associated Press style: "a.m." or "p.m".

        {% now "a" %} {# a.m. on in the morning#}

This might change if a locale module is loaded.

"A"

Returns AM or PM.

        {% now "A" %} {# AM #}

This might change if a locale module is loaded.

"b"

Returns the current month in 3 lowercase letters.

        {% now "b" %} {# dec #}

This might change if a locale module is loaded.

"d"

Returns the day of the month with a leading zero.

        {% now "d" %} {# 01 #} to {# 31 #}
"D"

Returns the day of the week in 3 letters (2 letters on some locales)

        {% now "D" %} {# Sun #}

This might change if a locale module is loaded.

"f"

Returns the time with hours and minutes, but minutes are left out if they are 0.

        {% now "f" %} o'clock {# 11:30 o'clock #} {# 3 o'clock #}
"F"

Returns the month in long form.

        {% now "F" %} {# December #}

This might change if a locale module is loaded.

"g"

Returns the hour in 12-hour format without leading zeros.

        {% now "g" %} {# 1 #} to {# 12 #}
"G"

Returns the hour in 24-hour format without leading zeros.

        {% now "G" %} {# 0 #} to {# 24 #}
"h"

Returns the hour in 12-hour format with a leading zero.

        {% now "h" %} {# 01 #} to {# 12 #}
"H"

Returns the hour in 24-hour format with a leading zero.

        {% now "H" %} {# 00 #} to {# 24 #}
"i"

Returns the minutes with a leading zero.

        {% now "i" %} {# 00 #} to {# 60 #}
"j"

Returns the day of the month without leading zeros.

        {% now "j" %} {# 1 #} to {# 31 #}
"l"

Returns the day of the week as a long text.

        {% now "l" %} {# Sunday #}

This might change if a locale module is loaded.

"L"

Returns 1 or 0 whether it's a leap year.

        {% now "L" %} {# 1 #}

Not that needed with now, but with the date filter

"m"

Returns the current month as a number with leading zeros.

        {% now "m" %} {# 01 #} to {# 12 #}
"M"

Returns the current month in 3 letters.

        {% now "M" %} {# Dec #}

This might change if a locale module is loaded.

"n"

Returns the current month as a number without leading zeros.

        {% now "m" %} {# 1 #} to {# 12 #}
"M"

Returns the current in Associated Press style notation.

        {% now "M" %} {# Jan. #} {# March #} {# July #}

This might change if a locale module is loaded.

"O"

Returns the difference to Greenwich time in hours.

        {% now "O" %} {# +0100 #}
"P"

Returns either the time in 12 hours and minutes if not zero with a.m. or p.m., midnight or noon.

        {% now "P" %} {# 1 p.m. #} {# 11:56 a.m. #} {# midnight #} {# noon #}
"r"

Returns an RFC 2822 formatted date.

        {% now "r" %} {# Sun, 28 Dec 2008 18:36:24 +0200' #}

This might change if a locale module is loaded.

"s"

Returns the seconds with a leading zero.

        {% now "s" %} {# 00 #} to {# 59 #}
"S"

Returns the ordinal suffix for the day of the month.

        {% now "S" %} {# st #} {# nd #} {# rd #} {# th #}

Defaults to english, this may change if a locale module is loaded.

"t"

Returns the number of days in the given month.

        {% now "t" %} {# 28 #} to  {# 31 #}
"T"

Returns the current timezone (needs the POSIX module)

        {% now "T" %} {# CET #} {# GMT #} {# EST #}...
"w"

Returns the day of week as a number from 0 (Sunday) to 6 (Saturday)

        {% now "w" %} {# 1 #} to {# 6 #}
"W"

Returns the ISO-8601 week number of year (uses the POSIX module), weeks start on monday.

        {% now "w" %} {# 1 #} to {# 53 #}
"y"

Returns the year in two digits (with leading zeros)

        {% now "y" %} {# 08 #}
"Y"

Returns the year in four (or more) digits (with leading zeros)

        {% now "Y" %} {# 2008 #}
"z"

Returns the day of the year without leading zeros

        {% now "z" %} {# 0 #} to {# 365 #}
"Z"

Returns the difference of the current timezone to GMT in seconds.

        {% now "Z" %} {# -43200 #} to {# 43200 #}

BUGS AND DIFFERENCES TO DJANGO

If you find any, please inform me about them.

SEE ALSO

http://www.djangoproject.com, Dotiac::DTL

LEGAL

Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.

AUTHOR

Marc-Sebastian Lucksch

perl@marc-s.de