TimeT FormatDateText() Method

Formats a date into a human-readable string using built-in date formats.

Function Signature

 string FormatDateText( attrib )

string FormatDateText( attrib, TimeZone tz, Locale loc, int dateformat, 
                       int timeformat, int dateFormatPref )

Parameters

Parameter Type Description

attrib

int

See DateTimeAttributeConstants for values.

tz

TimeZone

Timezone 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. If not provided, the current user's preference is used.

dateformat

int

See DateFormatConstants. Note that when the dateformat parameter is DateFormatConstants.FROM_LOCALE, the timeformat parameter is ignored. If not provided, the current user's preference is used.

timeformat

int

See TimeFormatConstants. If not provided, the current user's preference is used.

dateFormatPref

int

See DateFormatFromLocaleConstants. Only used when dateformat is set to DateFormatConstants.FROM_LOCALE. Indicates whether to use the terse or verbose format of the locale. If not provided, the current user's preference is used.

Return

Type Description

string

The date in human-readable text format.

Technical Details

SBM ModScript version: 11.3.

Example

var t = TimeT(1545721199ll);
var s = t.FormatDateText( DateTimeAttributeConstants.DATETIME, CreateTimeZone("MST"), 
    CreateLocale("en_US"), DateFormatConstants.FROM_LOCALE, 0, 
    DateFormatFromLocaleConstants.FULL );
Ext.WriteStream( s );

Result:

Monday, December 24, 2018 11:59:59 PM

Notes

None.

Related Topics

TimeT