SBM ModScript Reference → Programming SBM ModScript → Object Types → TimeT → TimeT FormatDateText() - Custom Format Method
Formats a date into a human-readable string using a custom date format.
string FormatDateText( string format ) string FormatDateText( string format, TimeZone tz, Locale loc )
Parameter | Type | Description |
---|---|---|
format |
string |
A string with symbols and literals. See notes below. |
tz |
TimeZone |
The time zone used to convert the point in time represented by the TimeT to text. If not provided, the current user's timezone is used. |
loc |
Locale |
Locale used during formatting. Especially important if dateformat is set to DateFormatConstants.FROM_LOCALE. Indicates language to use for keywords such as "AM", "PM", month names, day of week names, etc. |
Type | Description |
---|---|
string |
The date in human-readable text format. |
SBM ModScript version: 11.4.
var t = TimeT(1545721199ll); Ext.WriteStream( t.FormatDateText( "EEEE, MMMM d, yyyy h:mm:ss a z" ) );
Result:
Monday, December 24, 2018 11:59:59 PM MST
Format value is a string with symbols and literals (literals can be escaped inside single tick ( ' ) values if necessary). Symbols are described in ICU documentation. When formatting, the number of times a symbol occurs determines the length of values during output. For instance, "M" will output January as "1", but "MM" will output January as "01". When parsing, it is often best to provide the simplest option "M", which will work with both "1" and "01". Keep in mind that TimeT is measured in seconds, therefore millisecond values will always be zero.
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.