Locale FormatDateTimeCustom Example

Example using various custom datetime format strings.

Smartsite SXML CopyCode image Copy Code
{buffer.set(d, datetime.getdate(1956, 12, 3, 5, 38, 59))}

<table>
<tr><td>(d) Short date: </td><td>{locale.formatdatetimecustom($d,"d")}</td></tr>
<tr><td>(D) Long date: </td><td>{locale.formatdatetimecustom($d,"D")}</td></tr>
<tr><td>(t) Short time: </td><td>{locale.formatdatetimecustom($d,"t")}</td></tr>
<tr><td>(T) Long time: </td><td>{locale.formatdatetimecustom($d,"T")}</td></tr>
<tr><td>(f) Full date/short time: </td><td>{locale.formatdatetimecustom($d,"f")}</td></tr>
<tr><td>(F) Full date/long time: </td><td>{locale.formatdatetimecustom($d,"F")}</td></tr>
<tr><td>(g) General date/short time: </td><td>{locale.formatdatetimecustom($d,"g")}</td></tr>
<tr><td>(G) General date/long time: </td><td>{locale.formatdatetimecustom($d,"G")}</td></tr>
<tr><td>(R) RFC1123: </td><td>{locale.formatdatetimecustom($d,"R")}</td></tr>
<tr><td>(s) Sortable: </td><td>{locale.formatdatetimecustom($d,"s")}</td></tr>
<tr><td>(Y) Year-month pattern: </td><td>{locale.formatdatetimecustom($d,"Y")}</td></tr>
<tr><td>Custom pattern: </td><td>{locale.formatdatetimecustom($d,"dd-MM-yyyy HH:mm:ss tt")}</td></tr>
</table>
Example Result CopyCode image Copy Code
<table>
<tr><td>(d) Short date: </td><td>1956-12-03</td></tr>
<tr><td>(D) Long date: </td><td>Monday, December 3, 1956</td></tr>
<tr><td>(t) Short time: </td><td>05:38</td></tr>
<tr><td>(T) Long time: </td><td>05:38:59</td></tr>
<tr><td>(f) Full date/short time: </td><td>Monday, December 3, 1956 05:38</td></tr>
<tr><td>(F) Full date/long time: </td><td>Monday, December 3, 1956 05:38:59</td></tr>
<tr><td>(g) General date/short time: </td><td>1956-12-03 05:38</td></tr>
<tr><td>(G) General date/long time: </td><td>1956-12-03 05:38:59</td></tr>
<tr><td>(R) RFC1123: </td><td>Mon, 03 Dec 1956 05:38:59 GMT</td></tr>
<tr><td>(s) Sortable: </td><td>1956-12-03T05:38:59</td></tr>
<tr><td>(Y) Year-month pattern: </td><td>December 1956</td></tr>
<tr><td>Custom pattern: </td><td>03-12-1956 05:38:59 AM</td></tr>
</table>