<:date [fmt] [date] [lang] [to_zone] [from_zone]:>
Displays a string representation of a date/time object. This is an STML tag equivalent of the DateString function in the Skunk pylibs Date module.
Note that all attribute arguments to this tag are optional.
fmt must be a string, and specifies the format in which to display the date/time. If not specified, fmt defaults to the Date module's default format, which is the ISO format yyyy-mm-dd hh:mi:ss.
The fmt string may contain any combination of the following format elements. Anything not recognized as a format is included in the output as static text:
For all of the above, leading zeroes are included as necessary: ``01'' instead of 1, etc. However, if the format element is in UPPERCASE, leading zeroes are not included: ``MM'' -> ``1'', ``mm'' -> ``01''.
For all of the above, if the element is in UPPERCASE, the result will be in ALL CAPS: ``MONTH'' -> ``JANUARY''. If the element is Initcap, the result will be initcapped: ``Month'' -> ``January''. Any other combination of case will be considered lowercase: ``month'' or ``moNth'' -> ``january''.
Here are some examples, if the current date is 2000-08-01 20:34:56 (a Tuesday), and your server is running on Eastern Daylight Time, which is four hours behind UTC (Greenwich Time). Each tag is followed by the output which would be displayed:
<:date:> 2000-08-01 20:34:56 <:date "dd mon yy":> 01 aug 00 <:date "hh12:mi am":> 08:34 pm <:date "HH12:mi am":> 8:34 pm <:date "hh12:mi am" to_zone="UTC":> 12:34 am <:date "Month DD, yyyy, hh12:mi am" to_zone="UTC":> August 2, 2000, 12:34 am <:date "DD month yyyy, hhhmi" lang="esp" to_zone="UTC":> 2 agosto 2000 00h34
To do the equivalent in Python components, if unspecified arguments are None, is:
import Date temp_date = Date.Convert ( date, to_zone or 'LOCAL', from_zone or 'LOCAL' ) print Date.DateString ( temp_date, fmt, lang )