Class Reference
InterSystems: The power behind what matters   
Documentation  Search
 

class %SYS.NLS.Format extends %RegisteredObject, %SYSTEM.Help

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.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
23 50


Summary

Properties
AM DateFormat DateMaximum DateMinimum
DateSeparator DecimalSeparator Locale Midnight
MinusSign MonthAbbr MonthName Noon
NumericGroupSeparator NumericGroupSize PM PlusSign
PrivateLocale TimeFormat TimePrecision TimeSeparator
WeekdayAbbr WeekdayName YearOption

Methods
%%OIDGet %AddToSaveSet %BindExport %BuildObjectGraph
%ClassIsLatestVersion %ClassName %Close %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IncrementCount %IsA %IsModified
%New %NormalizeObject %ObjectModified %OnNew
%OriginalNamespace %PackageName %RemoveFromSaveSet %SerializeObject
%SetModified %ValidateObject AMGet AMSet
DateFormatGet DateFormatSet DateMaximumGet DateMaximumSet
DateMinimumGet DateMinimumSet DateSeparatorGet DateSeparatorSet
DecimalSeparatorGet DecimalSeparatorSet GetFormatItem Help
LocaleGet LocaleSet MidnightGet MidnightSet
MinusSignGet MinusSignSet MonthAbbrGet MonthAbbrSet
MonthNameGet MonthNameSet NoonGet NoonSet
NumericGroupSeparatorGet NumericGroupSeparatorSet NumericGroupSizeGet NumericGroupSizeSet
PMGet PMSet PlusSignGet PlusSignSet
SetFormatItem TimeFormatGet TimeFormatSet TimePrecisionGet
TimePrecisionSet TimeSeparatorGet TimeSeparatorSet UseLocale
WeekdayAbbrGet WeekdayAbbrSet WeekdayNameGet WeekdayNameSet
YearOptionGet YearOptionSet getformatindex setitem


Properties

• property AM as %String;
Sufix which may optionally be appended to time values prior to 12 noon.

Example: "AM"
• 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
• property DateMaximum as %Integer;
The maximum value for a date allowed in $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH functions.

Example: 94232 (12/30/2098)
• property DateMinimum as %Integer;
The minimum value for a date allowed in $ZDATE, $ZDATEH, $ZDATETIME or $ZDATETIMEH functions.

Example: 1
• property DateSeparator as %String;
The character used to delimit the months, days, and years of those dates which are otherwise entirely numeric.

Example: "/"
• 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: "."
• 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="<locale name>" (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.
• property Midnight as %String;
The suffix which may optionally be appended to time values corresponding to exactly 12 midnight.

Example: "MIDNIGHT"
• property MinusSign as %String;
The character which may precede or follow a negative numeric quantity formatted by the $FNUMBER function.

Example: "-"
• 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"
• 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"
• property Noon as %String;
The suffix which may optionally be appended to time values corresponding to exactly 12 noon.

Example: "NOON"
• 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: ","
• property NumericGroupSize as %Integer;
The number of digits in a numeric group formatted by the $FNUMBER function.

Example: 3
• property PM as %String;
The suffix which may optionally be appended to time values at or after 12 noon.

Example: "PM"
• property PlusSign as %String;
The character which may optionally precede or follow a non-negative numeric quantity formatted by the $FNUMBER function.

Example: "+"
• property PrivateLocale as %String;
This is where the Locale is actually stored.
• 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
• 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
• property TimeSeparator as %String;
The character used to delimit the hours, minutes and seconds in a time value.

Example: ":"
• 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"
• 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"
• 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

• method %OnNew(loc As %String = "") as %Status
This callback method is invoked by the %New method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

• method AMGet() as %String
This is a Get accessor method for the AM property.
• method AMSet(value As %String) as %Status
This is a Set accessor method for the AM property.
• method DateFormatGet() as %String
This is a Get accessor method for the DateFormat property.
• method DateFormatSet(value As %String) as %Status
This is a Set accessor method for the DateFormat property.
• method DateMaximumGet() as %String
This is a Get accessor method for the DateMaximum property.
• method DateMaximumSet(value As %String) as %Status
This is a Set accessor method for the DateMaximum property.
• method DateMinimumGet() as %String
This is a Get accessor method for the DateMinimum property.
• method DateMinimumSet(value As %String) as %Status
This is a Set accessor method for the DateMinimum property.
• method DateSeparatorGet() as %String
This is a Get accessor method for the DateSeparator property.
• method DateSeparatorSet(value As %String) as %Status
This is a Set accessor method for the DateSeparator property.
• method DecimalSeparatorGet() as %String
This is a Get accessor method for the DecimalSeparator property.
• method DecimalSeparatorSet(value As %String) as %Status
This is a Set accessor method for the DecimalSeparator property.
• 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
• method LocaleGet() as %String
This is a Get accessor method for the Locale property.
• method LocaleSet(new As %String) as %Status
This is a Set accessor method for the Locale property.
• method MidnightGet() as %String
This is a Get accessor method for the Midnight property.
• method MidnightSet(value As %String) as %Status
This is a Set accessor method for the Midnight property.
• method MinusSignGet() as %String
This is a Get accessor method for the MinusSign property.
• method MinusSignSet(value As %String) as %Status
This is a Set accessor method for the MinusSign property.
• method MonthAbbrGet() as %String
This is a Get accessor method for the MonthAbbr property.
• method MonthAbbrSet(value As %String) as %Status
This is a Set accessor method for the MonthAbbr property.
• method MonthNameGet() as %String
This is a Get accessor method for the MonthName property.
• method MonthNameSet(value As %String) as %Status
This is a Set accessor method for the MonthName property.
• method NoonGet() as %String
This is a Get accessor method for the Noon property.
• method NoonSet(value As %String) as %Status
This is a Set accessor method for the Noon property.
• method NumericGroupSeparatorGet() as %String
This is a Get accessor method for the NumericGroupSeparator property.
• method NumericGroupSeparatorSet(value As %String) as %Status
This is a Set accessor method for the NumericGroupSeparator property.
• method NumericGroupSizeGet() as %String
This is a Get accessor method for the NumericGroupSize property.
• method NumericGroupSizeSet(value As %String) as %Status
This is a Set accessor method for the NumericGroupSize property.
• method PMGet() as %String
This is a Get accessor method for the PM property.
• method PMSet(value As %String) as %Status
This is a Set accessor method for the PM property.
• method PlusSignGet() as %String
This is a Get accessor method for the PlusSign property.
• method PlusSignSet(value As %String) as %Status
This is a Set accessor method for the PlusSign property.
• 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
• method TimeFormatGet() as %String
This is a Get accessor method for the TimeFormat property.
• method TimeFormatSet(value As %String) as %Status
This is a Set accessor method for the TimeFormat property.
• method TimePrecisionGet() as %String
This is a Get accessor method for the TimePrecision property.
• method TimePrecisionSet(value As %String) as %Status
This is a Set accessor method for the TimePrecision property.
• method TimeSeparatorGet() as %String
This is a Get accessor method for the TimeSeparator property.
• method TimeSeparatorSet(value As %String) as %Status
This is a Set accessor method for the TimeSeparator property.
• 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
• method WeekdayAbbrGet() as %String
This is a Get accessor method for the WeekdayAbbr property.
• method WeekdayAbbrSet(value As %String) as %Status
This is a Set accessor method for the WeekdayAbbr property.
• method WeekdayNameGet() as %String
This is a Get accessor method for the WeekdayName property.
• method WeekdayNameSet(value As %String) as %Status
This is a Set accessor method for the WeekdayName property.
• method YearOptionGet() as %String
This is a Get accessor method for the YearOption property.
• method YearOptionSet(value As %String) as %Status
This is a Set accessor method for the YearOption property.
• classmethod getformatindex(item As %String) as %Integer
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
• classmethod setitem(index As %Integer, val As %String) as %Status
Helper function to the PropSet methods. Parameters:
  • index - item index
  • val - new value for item
Returns: previous item value or "" in case of error


Copyright © 1997-2018, InterSystems Corporation