6.3. convert_date
This tag converts a given date format into another format.
6.3.1. Summary
[convert_date day* other_named_attributes[/convert_date] [convert_date day=n* other_named_attributes[/convert_date]
Positional parameters: The first line shows the usage with positional parameters (given in order). The second line shows usage with named parameters.
Parameters | Description | Default |
days | The number of days from or before today | none |
Attributes | Default |
format | '%d-%b-%Y %I:%M%p' or '%d-%b-%Y' |
fmt - Alias for format | none |
raw | none |
zerofix | none |
Other_Characteristics | |
Invalidates cache | No |
Macro | No |
Has end tag | [/convert_date] |
Tag expansion example:
a. [convert-date][/convert-date] b. [convert-date 1][/convert-date] c. [convert-date -1][/convert-date] d. [convert-date]2001-5-1[/convert-date] e. [convert-date]2001-05-01[/convert-date] f. [convert-date]20010515[/convert-date] g. [convert-date raw=1]2001-05-18[/convert-date] h. [convert-date fmt="%d-%m-%Y"]2001-05-18[/convert-date] i. [convert-date]200 1 - --051 =9[/convert-date] j. [convert-date]2001 - --05 -20 11 1 5[/convert-date] k. [convert-date raw=1]2001-05-21 11:15[/convert-date] --- a. 18-May-2001 03:15AM (todays day and time) b. 19-May-2001 03:15AM (today + 1 day) c. 17-May-2001 03:15AM (today - 1 day) d. 01-May-2001 e. 01-May-2001 f. 15-May-2001 g. 20010518 h. 18-05-2001 i. 19-May-2001 j. 20-May-2001 11:15AM k. 200105211115
ASP-like Perl call:
$Tag->convert_date( { days => 1 } ); $Tag->convert_date( { body => "2001-05-19 15:35", format => "%d-%m-%Y %H:%M", } );
or similarly with positional parameters,
$Tag->convert_date( 1 );
6.3.2. Description
This tag converts almost any given date format into another, possibly user defined, format.
6.3.2.1. days
Number of days from or before today's date and time. Will only be used if nothing is supplied between the tags.
6.3.2.2. format
POSIX time format string of your choice. See Unix strftime(3) manpage for complete details.
6.3.2.3. raw
If this option is set to true, will display given date in raw format, e.g. yyyymmdd or yyyymmddHHMM.
6.3.2.4. zerofix
Strips leading zeroes from numbers.