Skip to main content

%SYS.NLS.Format

Class %SYS.NLS.Format Extends (%RegisteredObject, %SYSTEM.Help) [ Inheritance = right, System = 4 ]

This class exposes the NLS properties related to Date, Time and Number formats. Their initial values come from the current locale defaults. Changing a property of an instantiated object affects only the current process. For more details see the documentation for $ZDATE, $ZDATEH, $FNUMBER.

For generic locale properties see %SYS.NLS.Locale.
For system and process NLS table settings see %SYS.NLS.Table.
For current device NLS properties see %SYS.NLS.Device.

Properties

AM

Property AM As %String;

Sufix which may optionally be appended to time values prior to 12 noon.

Example: "AM"

DateFormat

Property DateFormat As %Integer;

The DateFormat code used whenever a $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH function call omits its second parameter, or specifies a second parameter value of -1.

Example: 1

DateMaximum

Property DateMaximum As %Integer;

The maximum value for a date allowed in $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH functions.

Example: 94232 (12/30/2098)

DateMinimum

Property DateMinimum As %Integer;

The minimum value for a date allowed in $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH functions.

Example: 1

DateSeparator

Property DateSeparator As %String;

The character used to delimit the months, days, and years of those dates which are otherwise entirely numeric.

Example: "/"

DecimalSeparator

Property DecimalSeparator As %String;

The character used by the $FNUMBER function to separate the whole part of a number from the fractional part of the number. Also used by $ZDATETIME, $ZDATETIMEH, $ZTIME and $ZTIMEH to separate the whole part of the seconds from the optional fractional part of the seconds, if any.

Example: "."

Locale

Property Locale As %String;

This property controls the source of the formats.

Locale="" means that the system default formats (usually US English) are in effect for the current process.

Locale="" (eg: "rusw" or "csy8") means that the formats come from that locale.

This property may be changed after the object is instantiated or by passing the desired locale to %New. For example:

Set fmt=##class(%SYS.NLS.Format).%New("jpnw")

As a convenience, the word "Current" can be used instead of a locale name in order to mean the current locale.

PrivateLocale

Property PrivateLocale As %String [ Internal ];

This is where the Locale is actually stored.

Midnight

Property Midnight As %String;

The suffix which may optionally be appended to time values corresponding to exactly 12 midnight.

Example: "MIDNIGHT"

MinusSign

Property MinusSign As %String;

The character which may precede or follow a negative numeric quantity formatted by the $FNUMBER function.

Example: "-"

MonthAbbr

Property MonthAbbr As %String;

The abbreviations of the names of the twelve months, used whenever a $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH function call omits its MonthNameList parameter, or specifies a MonthNameList parameter value of -1, and the selected date format uses month name abbreviations (i.e., the effective DateFormat code is 0, 2, 5, 6 or 7)

Example: " Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"

MonthName

Property MonthName As %String;

The full names of the twelve months, used whenever a $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH function call omits its MonthNameList parameter, or specifies a MonthNameList parameter value of -1, and the selected date format uses full month names (i.e., the effective DateFormat code is 9).

Example: " January February March April... November December"

Noon

Property Noon As %String;

The suffix which may optionally be appended to time values corresponding to exactly 12 noon.

Example: "NOON"

NumericGroupSeparator

Property NumericGroupSeparator As %String;

The character used to separate groups of numeric digits within the whole number portion of a number formatted by the $FNUMBER function.

Example: ","

NumericGroupSize

Property NumericGroupSize As %Integer;

The number of digits in a numeric group formatted by the $FNUMBER function.

Example: 3

PM

Property PM As %String;

The suffix which may optionally be appended to time values at or after 12 noon.

Example: "PM"

PlusSign

Property PlusSign As %String;

The character which may optionally precede or follow a non-negative numeric quantity formatted by the $FNUMBER function.

Example: "+"

TimeFormat

Property TimeFormat As %Integer;

The TimeFormat code used whenever a $ZDATETIME, $ZDATETIMEH, $ZTIME or $ZTIMEH function call omits its TimeFormat parameter, or specifies a TimeFormat parameter value of -1.

Example: 1

TimePrecision

Property TimePrecision As %Integer;

The number of fractional digits displayed in a time value whenever a $ZDATETIME or $ZTIME function call omits its Precision parameter, or specifies a Precision parameter value of -1.

Example: 0

TimeSeparator

Property TimeSeparator As %String;

The character used to delimit the hours, minutes and seconds in a time value.

Example: ":"

WeekdayAbbr

Property WeekdayAbbr As %String;

The abbreviations of the names of the seven days of the week, starting with Sunday and ending with Saturday, used whenever a $ZDATE or $ZDATEIME function call selects a date format which uses weekday name abbreviations (i.e., the effective DateFormat code is 11).

Example: " Sun Mon Tue Wed Thu Fri Sat"

WeekdayName

Property WeekdayName As %String;

The full names of the seven days of the week, starting with Sunday and ending with Saturday, used whenever a $ZDATE or $ZDATEIME function call selects a date format which uses full weekday names (i.e., the effective DateFormat code is 12).

Example: " Sunday Monday Tuesday... Friday Saturday"

YearOption

Property YearOption As %Integer;

The YearOption code used whenever a $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH function call omits its YearOption parameter, or specifies a YearOption parameter value of -1.

Example: 0

Methods

LocaleGet

Method LocaleGet() As %String [ Internal ]

LocaleSet

Method LocaleSet(new As %String) As %Status [ Internal ]

AMGet

Method AMGet() As %String [ Internal ]

AMSet

Method AMSet(value As %String) As %Status [ Internal ]

PMGet

Method PMGet() As %String [ Internal ]

PMSet

Method PMSet(value As %String) As %Status [ Internal ]

NoonGet

Method NoonGet() As %String [ Internal ]

NoonSet

Method NoonSet(value As %String) As %Status [ Internal ]

MidnightGet

Method MidnightGet() As %String [ Internal ]

MidnightSet

Method MidnightSet(value As %String) As %Status [ Internal ]

MonthNameGet

Method MonthNameGet() As %String [ Internal ]

MonthNameSet

Method MonthNameSet(value As %String) As %Status [ Internal ]

MonthAbbrGet

Method MonthAbbrGet() As %String [ Internal ]

MonthAbbrSet

Method MonthAbbrSet(value As %String) As %Status [ Internal ]

WeekdayNameGet

Method WeekdayNameGet() As %String [ Internal ]

WeekdayNameSet

Method WeekdayNameSet(value As %String) As %Status [ Internal ]

WeekdayAbbrGet

Method WeekdayAbbrGet() As %String [ Internal ]

WeekdayAbbrSet

Method WeekdayAbbrSet(value As %String) As %Status [ Internal ]

DateFormatGet

Method DateFormatGet() As %String [ Internal ]

DateFormatSet

Method DateFormatSet(value As %String) As %Status [ Internal ]

DateMinimumGet

Method DateMinimumGet() As %String [ Internal ]

DateMinimumSet

Method DateMinimumSet(value As %String) As %Status [ Internal ]

DateMaximumGet

Method DateMaximumGet() As %String [ Internal ]

DateMaximumSet

Method DateMaximumSet(value As %String) As %Status [ Internal ]

DateSeparatorGet

Method DateSeparatorGet() As %String [ Internal ]

DateSeparatorSet

Method DateSeparatorSet(value As %String) As %Status [ Internal ]

YearOptionGet

Method YearOptionGet() As %String [ Internal ]

YearOptionSet

Method YearOptionSet(value As %String) As %Status [ Internal ]

TimeFormatGet

Method TimeFormatGet() As %String [ Internal ]

TimeFormatSet

Method TimeFormatSet(value As %String) As %Status [ Internal ]

TimePrecisionGet

Method TimePrecisionGet() As %String [ Internal ]

TimePrecisionSet

Method TimePrecisionSet(value As %String) As %Status [ Internal ]

TimeSeparatorGet

Method TimeSeparatorGet() As %String [ Internal ]

TimeSeparatorSet

Method TimeSeparatorSet(value As %String) As %Status [ Internal ]

DecimalSeparatorGet

Method DecimalSeparatorGet() As %String [ Internal ]

DecimalSeparatorSet

Method DecimalSeparatorSet(value As %String) As %Status [ Internal ]

NumericGroupSeparatorGet

Method NumericGroupSeparatorGet() As %String [ Internal ]

NumericGroupSeparatorSet

Method NumericGroupSeparatorSet(value As %String) As %Status [ Internal ]

NumericGroupSizeGet

Method NumericGroupSizeGet() As %String [ Internal ]

NumericGroupSizeSet

Method NumericGroupSizeSet(value As %String) As %Status [ Internal ]

MinusSignGet

Method MinusSignGet() As %String [ Internal ]

MinusSignSet

Method MinusSignSet(value As %String) As %Status [ Internal ]

PlusSignGet

Method PlusSignGet() As %String [ Internal ]

PlusSignSet

Method PlusSignSet(value As %String) As %Status [ Internal ]

setitem

ClassMethod setitem(index As %Integer, val As %String) As %Status [ Internal ]

Helper function to the PropSet methods. Parameters:

  • index - item index
  • val - new value for item Returns: previous item value or "" in case of error

GetFormatItem

ClassMethod GetFormatItem(item As %String) As %String

Gets a format item from the current process context

Parameter:

  • item - item name (eg: "YEAROPTION", "DATEFORMAT") Returns: selected item or "" in case of error

SetFormatItem

ClassMethod SetFormatItem(item As %String, val As %String) As %String

Sets a format item in the current process context

Parameters:

  • item - item name (eg: "YEAROPTION", "DATEFORMAT")
  • val - new value for item Returns: previous item value or "" in case of error

getformatindex

ClassMethod getformatindex(item As %String) As %Integer [ Internal ]

Gets the index associated with a Format item name

Parameter:

  • item - item name (eg: "YEAROPTION", "DATEFORMAT") Returns: item index or -1 in case of error

UseLocale

ClassMethod UseLocale(new As %Boolean) As %Boolean

Gets the system flag that indicates whether date/time/number functions should use the locale format by default. Besides, if a new boolean flag is passed as an argument, the system flag is set to this new value. A system reboot or locale reload is necessary to activate the change.

Parameter: (optional)

  • new - sets locale format flag to this value (0 or 1) Returns: previous value of the system locale format flag

%OnNew

Method %OnNew(loc As %String = "") As %Status [ Internal ]