2.75. time
2.75.1. Summary
Parameters: locale
Positional parameters in same order.
The attribute hash reference is passed after the parameters but before the container text argument. This may mean that there are parameters not shown here.
Must pass named parameter interpolate=1 to cause interpolation.
This is a container tag, i.e. [time] FOO [/time]. Nesting: NO
Invalidates cache: no
Called Routine:
ASP-like Perl call:
$Tag->time( { locale => VALUE, }, BODY ) OR $Tag->time($locale, $ATTRHASH, $BODY);
2.75.2. Description
Formats the current time according to POSIX strftime arguments. The following is the string for Monday, January 1, 2001.
[time]%A, %B %d, %Y[/tag]
See the strftime man page for information on the arguments (which are the same as modern UNIX date commands).
Accepts the following options:
2.75.2.1. adjust
If you wish to temporarily adjust the time for display purposes, you can pass an adjust parameter with the number of hours (plus or minus) from the local time or from GMT:
[time]%c[/time] [time adjust="-3"]%c[/time]
Will display:
Mon 01 Jan 2001 11:29:03 AM EST Mon 01 Jan 2001 08:29:03 AM EST
Note that the time zone does not change -- you should either pick a format which doesn't display zone, use the tz parameter, or manage it yourself.
NOTE: You can adjust time globally for an Interchange installation by setting the $ENV{TZ} variable on many systems. Set TZ in your environment and then restart Interchange:
## bash/ksh/sh TZ=PST7PDT; export TZ interchange -restart ## csh/tcsh setenv TZ PST7PDT interchange -restart
On most modern UNIX systems, all times will now be in the PST zone.
2.75.2.2. gmt
If you want to display time as GMT, use the gmt parameter:
[time]%c[/time] [time gmt=1]%c[/time]
will display:
Mon 01 Jan 2001 11:33:26 AM EST Mon 01 Jan 2001 04:33:26 PM EST
Once again, the zone will not be set to GMT, so you should pick a format string which doesn't use zone, use the tz parameter, or manage it yourself.
2.75.2.3. locale
Format the time according to the named locale, assuming that locale is available on your operating system. For example, the following:
[time locale=en_US]%B %d, %Y[/time] [time locale=fr_FR]%B %d, %Y[/time]
should display:
January 01, 2001 janvier 01, 2001
2.75.2.4. tz
Use the passed tz to display the time. Will adjust for hours difference.
Example:
[time tz=GMT0] [time tz=CST6CDT] [time tz=PST8PDT]
will display:
Mon 01 Jan 2001 04:43:02 PM GMT Mon 01 Jan 2001 10:43:02 AM CST Mon 01 Jan 2001 08:43:02 AM PST
Note that the first alphabetical string is the zone name when not under daylight savings time, the digit is the number of hours displacement from GMT, and the second alphabetical string is the zone name when in daylight savings time. NOTE: This may not work on all operating systems.
2.75.2.5. zerofix
Strips leading zeroes from numbers.