License:
BSD style: see license.txt
Version:
Initial release: 2005
author:
John Chapman
Contains classes that provide information about locales, such as
the language and calendars, as well as cultural conventions used
for formatting dates, currency and numbers. Use these classes when
writing applications for an international audience.
- enum
CultureTypes
;
- Defines the types of cultures that can be retrieved from Culture.getCultures.
-
Neutral
- Refers to cultures that are associated with a language but not specific to a country or region.
-
Specific
- Refers to cultures that are specific to a country or region.
-
All
- Refers to all cultures.
- interface
IFormatService
;
-
Retrieves an object to control formatting.
A class implements getFormat to retrieve an object that provides format information for the implementing type.
Remarks:
IFormatService
is implemented by Culture, NumberFormat and DateTimeFormat to provide locale-specific formatting of
numbers and date and time values.
- abstract Object
getFormat
(TypeInfo type);
-
Retrieves an object that supports formatting for the specified type.
Returns:
The current instance if type is the same type as the current instance; otherwise, null.
Params:
| TypeInfo type |
An object that specifies the type of formatting to retrieve. |
- class
Culture
: tango.text.locale.Core.IFormatService;
-
Provides information about a culture, such as its name, calendar and date and number format patterns.
Remarks:
tango.text.locale adopts the RFC 1766 standard for culture names in the format <language>"-"<region>.
<language> is a lower-case two-letter code defined by ISO 639-1. <region> is an upper-case
two-letter code defined by ISO 3166. For example, "en-GB" is UK English.
There are three types of culture: invariant, neutral and specific. The invariant culture is not tied to
any specific region, although it is associated with the English language. A neutral culture is associated with
a language, but not with a region. A specific culture is associated with a language and a region. "es" is a neutral
culture. "es-MX" is a specific culture.
Instances of DateTimeFormat and NumberFormat cannot be created for neutral cultures.
Examples:
import tango.io.Stdout, tango.text.locale.Core;
void main() {
Culture culture = new Culture("it-IT");
Stdout.formatln("englishName: {}", culture.englishName);
Stdout.formatln("nativeName: {}", culture.nativeName);
Stdout.formatln("name: {}", culture.name);
Stdout.formatln("parent: {}", culture.parent.name);
Stdout.formatln("isNeutral: {}", culture.isNeutral);
}
// Produces the following output:
// englishName: Italian (Italy)
// nativeName: italiano (Italia)
// name: it-IT
// parent: it
// isNeutral: false
- this(char[] cultureName);
- Initializes a new Culture instance from the supplied name.
Params:
| char[] cultureName |
The name of the Culture. |
- this(int cultureID);
- Initializes a new Culture instance from the supplied culture identifier.
Params:
| int cultureID |
The identifer (LCID) of the Culture. |
Remarks:
Culture identifiers correspond to a Windows LCID.
- Object
getFormat
(TypeInfo type);
- Retrieves an object defining how to format the specified type.
Params:
| TypeInfo type |
The TypeInfo of the resulting formatting object. |
Returns:
If type is typeid(NumberFormat), the value of the numberFormat property. If type is typeid(DateTimeFormat), the
value of the dateTimeFormat property. Otherwise, null.
Remarks:
Implements IFormatService.
getFormat
.
- static Culture
getCulture
(int cultureID);
- Returns a read-only instance of a culture using the specified culture identifier.
Params:
| int cultureID |
The identifier of the culture. |
Returns:
A read-only culture instance.
Remarks:
Instances returned by this method are cached.
- static Culture
getCulture
(char[] cultureName);
- Returns a read-only instance of a culture using the specified culture name.
Params:
| char[] cultureName |
The name of the culture. |
Returns:
A read-only culture instance.
Remarks:
Instances returned by this method are cached.
- static Culture
getCultureFromIetfLanguageTag
(char[] name);
- Returns a read-only instance using the specified name, as defined by the RFC 3066 standard and maintained by the IETF.
Params:
| char[] name |
The name of the language. |
Returns:
A read-only culture instance.
- static Culture[]
getCultures
(CultureTypes types);
- Returns a list of cultures filtered by the specified CultureTypes.
Params:
| CultureTypes types |
A combination of CultureTypes. |
Returns:
An array of Culture instances containing cultures specified by types.
- char[]
toString
();
- Returns the name of the Culture.
Returns:
A string containing the name of the Culture in the format <language>"-"<region>.
- static Culture
current
();
-
Property. Retrieves the culture of the
current
user.
Returns:
The Culture instance representing the user's
current
culture.
- static void
current
(Culture value);
- Property. Assigns the culture of the current user.
Params:
| Culture value |
The Culture instance representing the user's current culture. |
Examples:
The following examples shows how to change the current culture.
import tango.io.Print, tango.text.locale.Common;
void main() {
// Displays the name of the current culture.
Println("The current culture is %s.", Culture.current.englishName);
// Changes the current culture to el-GR.
Culture.current = new Culture("el-GR");
Println("The current culture is now %s.", Culture.current.englishName);
}
// Produces the following output:
// The current culture is English (United Kingdom).
// The current culture is now Greek (Greece).
- static Culture
invariantCulture
();
- Property. Retrieves the invariant Culture.
Returns:
The Culture instance that is invariant.
Remarks:
The invariant culture is culture-independent. It is not tied to any specific region, but is associated
with the English language.
- int
id
();
- Property. Retrieves the identifier of the Culture.
Returns:
The culture identifier of the current instance.
Remarks:
The culture identifier corresponds to the Windows locale identifier (LCID). It can therefore be used when
interfacing with the Windows NLS functions.
- char[]
name
();
-
Property. Retrieves the
name
of the Culture in the format <language>"-"<region>.
Returns:
The
name
of the current instance. For example, the
name
of the UK English culture is "en-GB".
- char[]
englishName
();
- Property. Retrieves the name of the Culture in the format <languagename> (<regionname>) in English.
Returns:
The name of the current instance in English. For example, the
englishName
of the UK English culture
is "English (United Kingdom)".
- char[]
nativeName
();
- Property. Retrieves the name of the Culture in the format <languagename> (<regionname>) in its native language.
Returns:
The name of the current instance in its native language. For example, if Culture.name is "de-DE",
nativeName
is
"Deutsch (Deutschland)".
- char[]
twoLetterLanguageName
();
- Property. Retrieves the two-letter language code of the culture.
Returns:
The two-letter language code of the Culture instance. For example, the
twoLetterLanguageName
for English is "en".
- char[]
threeLetterLanguageName
();
- Property. Retrieves the three-letter language code of the culture.
Returns:
The three-letter language code of the Culture instance. For example, the
threeLetterLanguageName
for English is "eng".
- final char[]
ietfLanguageTag
();
- Property. Retrieves the RFC 3066 identification for a language.
Returns:
A string representing the RFC 3066 language identification.
- Culture
parent
();
- Property. Retrieves the Culture representing the
parent
of the current instance.
Returns:
The Culture representing the
parent
of the current instance.
- bool
isNeutral
();
- Property. Retrieves a value indicating whether the current instance is a neutral culture.
Returns:
true is the current Culture represents a neutral culture; otherwise, false.
Examples:
The following example displays which cultures using Chinese are neutral.
import tango.io.Print, tango.text.locale.Common;
void main() {
foreach (c; Culture.getCultures(CultureTypes.All)) {
if (c.twoLetterLanguageName == "zh") {
Print(c.englishName);
if (c.isNeutral)
Println("neutral");
else
Println("specific");
}
}
}
// Produces the following output:
// Chinese (Simplified) - neutral
// Chinese (Taiwan) - specific
// Chinese (People's Republic of China) - specific
// Chinese (Hong Kong S.A.R.) - specific
// Chinese (Singapore) - specific
// Chinese (Macao S.A.R.) - specific
// Chinese (Traditional) - neutral
- final bool
isReadOnly
();
- Property. Retrieves a value indicating whether the instance is read-only.
Returns:
true if the instance is read-only; otherwise, false.
Remarks:
If the culture is read-only, the dateTimeFormat and numberFormat properties return
read-only instances.
- Calendar
calendar
();
-
Property. Retrieves the
calendar
used by the culture.
Returns:
A Calendar instance respresenting the
calendar
used by the culture.
- Calendar[]
optionalCalendars
();
- Property. Retrieves the list of calendars that can be used by the culture.
Returns:
An array of type Calendar representing the calendars that can be used by the culture.
- NumberFormat
numberFormat
();
-
Property. Retrieves a NumberFormat defining the culturally appropriate format for displaying numbers and currency.
Returns:
A NumberFormat defining the culturally appropriate format for displaying numbers and currency.
- void
numberFormat
(NumberFormat value);
- Property. Assigns a NumberFormat defining the culturally appropriate format for displaying numbers and currency.
Params:
| values |
A NumberFormat defining the culturally appropriate format for displaying numbers and currency. |
- DateTimeFormat
dateTimeFormat
();
-
Property. Retrieves a DateTimeFormat defining the culturally appropriate format for displaying dates and times.
Returns:
A DateTimeFormat defining the culturally appropriate format for displaying dates and times.
- void
dateTimeFormat
(DateTimeFormat value);
- Property. Assigns a DateTimeFormat defining the culturally appropriate format for displaying dates and times.
Params:
| values |
A DateTimeFormat defining the culturally appropriate format for displaying dates and times. |
- class
Region
;
-
Provides information about a region.
Remarks:
Region
does not represent user preferences. It does not depend on the user's language or culture.
Examples:
The following example displays some of the properties of the
Region
class:
import tango.io.Print, tango.text.locale.Common;
void main() {
Region region = new Region("en-GB");
Println("name: %s", region.name);
Println("englishName: %s", region.englishName);
Println("isMetric: %s", region.isMetric);
Println("currencySymbol: %s", region.currencySymbol);
Println("isoCurrencySymbol: %s", region.isoCurrencySymbol);
}
// Produces the following output.
// name: en-GB
// englishName: United Kingdom
// isMetric: true
// currencySymbol: £
// isoCurrencySymbol: GBP
- this(int cultureID);
- Initializes a new Region instance based on the region associated with the specified culture identifier.
Params:
| int cultureID |
A culture indentifier. |
Remarks:
The name of the Region instance is set to the ISO 3166 two-letter code for that region.
- this(char[] name);
-
Initializes a new Region instance based on the region specified by name.
Params:
| char[] name |
A two-letter ISO 3166 code for the region. Or, a culture name consisting of the language and region. |
- static Region
current
();
- Property. Retrieves the Region used by the
current
Culture.
Returns:
The Region instance associated with the
current
Culture.
- int
geoID
();
- Property. Retrieves a unique identifier for the geographical location of the region.
Returns:
An int uniquely identifying the geographical location.
- char[]
name
();
-
Property. Retrieves the ISO 3166 code, or the
name
, of the current Region.
Returns:
The value specified by the
name
parameter of the Region(char[]) constructor.
- char[]
englishName
();
- Property. Retrieves the full name of the region in English.
Returns:
The full name of the region in English.
- char[]
nativeName
();
- Property. Retrieves the full name of the region in its native language.
Returns:
The full name of the region in the language associated with the region code.
- char[]
twoLetterRegionName
();
- Property. Retrieves the two-letter ISO 3166 code of the region.
Returns:
The two-letter ISO 3166 code of the region.
- char[]
threeLetterRegionName
();
- Property. Retrieves the three-letter ISO 3166 code of the region.
Returns:
The three-letter ISO 3166 code of the region.
- char[]
currencySymbol
();
- Property. Retrieves the currency symbol of the region.
Returns:
The currency symbol of the region.
- char[]
isoCurrencySymbol
();
- Property. Retrieves the three-character currency symbol of the region.
Returns:
The three-character currency symbol of the region.
- char[]
currencyEnglishName
();
- Property. Retrieves the name in English of the currency used in the region.
Returns:
The name in English of the currency used in the region.
- char[]
currencyNativeName
();
- Property. Retrieves the name in the native language of the region of the currency used in the region.
Returns:
The name in the native language of the region of the currency used in the region.
- bool
isMetric
();
- Property. Retrieves a value indicating whether the region uses the metric system for measurements.
Returns:
true is the region uses the metric system; otherwise, false.
- char[]
toString
();
- Returns a string containing the ISO 3166 code, or the name, of the current Region.
Returns:
A string containing the ISO 3166 code, or the name, of the current Region.
- class
NumberFormat
: tango.text.locale.Core.IFormatService;
-
Determines how numbers are formatted, according to the current culture.
Remarks:
Numbers are formatted using format patterns retrieved from a
NumberFormat
instance.
This class implements IFormatService.getFormat.
Examples:
The following example shows how to retrieve an instance of
NumberFormat
for a Culture
and use it to display number formatting information.
import tango.io.Print, tango.text.locale.Common;
void main(char[][] args) {
foreach (c; Culture.getCultures(CultureTypes.Specific)) {
if (c.twoLetterLanguageName == "en") {
NumberFormat fmt = c.numberFormat;
Println("The currency symbol for %s is '%s'",
c.englishName,
fmt.currencySymbol);
}
}
}
// Produces the following output:
// The currency symbol for English (United States) is '$'
// The currency symbol for English (United Kingdom) is '£'
// The currency symbol for English (Australia) is '$'
// The currency symbol for English (Canada) is '$'
// The currency symbol for English (New Zealand) is '$'
// The currency symbol for English (Ireland) is '€'
// The currency symbol for English (South Africa) is 'R'
// The currency symbol for English (Jamaica) is 'J$'
// The currency symbol for English (Caribbean) is '$'
// The currency symbol for English (Belize) is 'BZ$'
// The currency symbol for English (Trinidad and Tobago) is 'TT$'
// The currency symbol for English (Zimbabwe) is 'Z$'
// The currency symbol for English (Republic of the Philippines) is 'Php'
- this();
- Initializes a new, culturally independent instance.
Remarks:
Modify the properties of the new instance to define custom formatting.
- Object
getFormat
(TypeInfo type);
- Retrieves an object defining how to format the specified type.
Params:
| TypeInfo type |
The TypeInfo of the resulting formatting object. |
Returns:
If type is typeid(NumberFormat), the current NumberFormat instance. Otherwise, null.
Remarks:
Implements IFormatService.
getFormat
.
- static NumberFormat
getInstance
(IFormatService formatService);
- Retrieves the NumberFormat for the specified IFormatService.
Params:
| IFormatService formatService |
The IFormatService used to retrieve NumberFormat. |
Returns:
The NumberFormat for the specified IFormatService.
Remarks:
The method calls IFormatService.getFormat with typeof(NumberFormat). If formatService is null,
then the value of the current property is returned.
- static NumberFormat
current
();
- Property. Retrieves a read-only NumberFormat instance from the
current
culture.
Returns:
A read-only NumberFormat instance from the
current
culture.
- static NumberFormat
invariantFormat
();
-
Property. Retrieves the read-only, culturally independent NumberFormat instance.
Returns:
The read-only, culturally independent NumberFormat instance.
- final bool
isReadOnly
();
- Property. Retrieves a value indicating whether the instance is read-only.
Returns:
true if the instance is read-only; otherwise, false.
- final int
numberDecimalDigits
();
- Property. Retrieves the number of decimal places used for numbers.
Returns:
The number of decimal places used for numbers. For invariantFormat, the default is 2.
- final void
numberDecimalDigits
(int value);
- Assigns the number of decimal digits used for numbers.
Params:
| int value |
The number of decimal places used for numbers. |
Throws:
Exception if the property is being set and the instance is read-only.
Examples:
The following example shows the effect of changing
numberDecimalDigits
.
import tango.io.Print, tango.text.locale.Common;
void main() {
// Get the NumberFormat from the en-GB culture.
NumberFormat fmt = (new Culture("en-GB")).numberFormat;
// Display a value with the default number of decimal digits.
int n = 5678;
Println(Formatter.format(fmt, "{0:N}", n));
// Display the value with six decimal digits.
fmt.numberDecimalDigits = 6;
Println(Formatter.format(fmt, "{0:N}", n));
}
// Produces the following output:
// 5,678.00
// 5,678.000000
- final int
numberNegativePattern
();
- Property. Retrieves the format pattern for negative numbers.
Returns:
The format pattern for negative numbers. For invariantFormat, the default is 1 (representing "-n").
Remarks:
The following table shows valid values for this property.
| Value | Pattern |
| 0 | (n) |
| 1 | -n |
| 2 | - n |
| 3 | n- |
| 4 | n - |
- final void
numberNegativePattern
(int value);
- Property. Assigns the format pattern for negative numbers.
Params:
| int value |
The format pattern for negative numbers. |
Examples:
The following example shows the effect of the different patterns.
import tango.io.Print, tango.text.locale.Common;
void main() {
NumberFormat fmt = new NumberFormat;
int n = -5678;
// Display the default pattern.
Println(Formatter.format(fmt, "{0:N}", n));
// Display all patterns.
for (int i = 0; i <= 4; i++) {
fmt.numberNegativePattern = i;
Println(Formatter.format(fmt, "{0:N}", n));
}
}
// Produces the following output:
// (5,678.00)
// (5,678.00)
// -5,678.00
// - 5,678.00
// 5,678.00-
// 5,678.00 -
- final int
currencyDecimalDigits
();
- Property. Retrieves the number of decimal places to use in currency values.
Returns:
The number of decimal digits to use in currency values.
- final void
currencyDecimalDigits
(int value);
- Property. Assigns the number of decimal places to use in currency values.
Params:
| int value |
The number of decimal digits to use in currency values. |
- final int
currencyNegativePattern
();
- Property. Retrieves the formal pattern to use for negative currency values.
Returns:
The format pattern to use for negative currency values.
- final void
currencyNegativePattern
(int value);
- Property. Assigns the formal pattern to use for negative currency values.
Params:
| int value |
The format pattern to use for negative currency values. |
- final int
currencyPositivePattern
();
- Property. Retrieves the formal pattern to use for positive currency values.
Returns:
The format pattern to use for positive currency values.
- final void
currencyPositivePattern
(int value);
- Property. Assigns the formal pattern to use for positive currency values.
Returns:
The format pattern to use for positive currency values.
- final int[]
numberGroupSizes
();
- Property. Retrieves the number of digits int each group to the left of the decimal place in numbers.
Returns:
The number of digits int each group to the left of the decimal place in numbers.
- final void
numberGroupSizes
(int[] value);
- Property. Assigns the number of digits int each group to the left of the decimal place in numbers.
Params:
| int[] value |
The number of digits int each group to the left of the decimal place in numbers. |
- final int[]
currencyGroupSizes
();
- Property. Retrieves the number of digits int each group to the left of the decimal place in currency values.
Returns:
The number of digits int each group to the left of the decimal place in currency values.
- final void
currencyGroupSizes
(int[] value);
- Property. Assigns the number of digits int each group to the left of the decimal place in currency values.
Params:
| int[] value |
The number of digits int each group to the left of the decimal place in currency values. |
- final char[]
numberGroupSeparator
();
- Property. Retrieves the string separating groups of digits to the left of the decimal place in numbers.
Returns:
The string separating groups of digits to the left of the decimal place in numbers. For example, ",".
- final void
numberGroupSeparator
(char[] value);
- Property. Assigns the string separating groups of digits to the left of the decimal place in numbers.
Params:
| char[] value |
The string separating groups of digits to the left of the decimal place in numbers. |
- final char[]
numberDecimalSeparator
();
- Property. Retrieves the string used as the decimal separator in numbers.
Returns:
The string used as the decimal separator in numbers. For example, ".".
- final void
numberDecimalSeparator
(char[] value);
- Property. Assigns the string used as the decimal separator in numbers.
Params:
| char[] value |
The string used as the decimal separator in numbers. |
- final char[]
currencyGroupSeparator
();
- Property. Retrieves the string separating groups of digits to the left of the decimal place in currency values.
Returns:
The string separating groups of digits to the left of the decimal place in currency values. For example, ",".
- final void
currencyGroupSeparator
(char[] value);
- Property. Assigns the string separating groups of digits to the left of the decimal place in currency values.
Params:
| char[] value |
The string separating groups of digits to the left of the decimal place in currency values. |
- final char[]
currencyDecimalSeparator
();
- Property. Retrieves the string used as the decimal separator in currency values.
Returns:
The string used as the decimal separator in currency values. For example, ".".
- final void
currencyDecimalSeparator
(char[] value);
- Property. Assigns the string used as the decimal separator in currency values.
Params:
| char[] value |
The string used as the decimal separator in currency values. |
- final char[]
currencySymbol
();
- Property. Retrieves the string used as the currency symbol.
Returns:
The string used as the currency symbol. For example, "£".
- final void
currencySymbol
(char[] value);
- Property. Assigns the string used as the currency symbol.
Params:
| char[] value |
The string used as the currency symbol. |
- final char[]
negativeSign
();
- Property. Retrieves the string denoting that a number is negative.
Returns:
The string denoting that a number is negative. For example, "-".
- final void
negativeSign
(char[] value);
- Property. Assigns the string denoting that a number is negative.
Params:
| char[] value |
The string denoting that a number is negative. |
- final char[]
positiveSign
();
- Property. Retrieves the string denoting that a number is positive.
Returns:
The string denoting that a number is positive. For example, "+".
- final void
positiveSign
(char[] value);
- Property. Assigns the string denoting that a number is positive.
Params:
| char[] value |
The string denoting that a number is positive. |
- final char[]
nanSymbol
();
- Property. Retrieves the string representing the NaN (not a number) value.
Returns:
The string representing the NaN value. For example, "NaN".
- final void
nanSymbol
(char[] value);
- Property. Assigns the string representing the NaN (not a number) value.
Params:
| char[] value |
The string representing the NaN value. |
- final char[]
negativeInfinitySymbol
();
- Property. Retrieves the string representing negative infinity.
Returns:
The string representing negative infinity. For example, "-Infinity".
- final void
negativeInfinitySymbol
(char[] value);
- Property. Assigns the string representing negative infinity.
Params:
| char[] value |
The string representing negative infinity. |
- final char[]
positiveInfinitySymbol
();
- Property. Retrieves the string representing positive infinity.
Returns:
The string representing positive infinity. For example, "Infinity".
- final void
positiveInfinitySymbol
(char[] value);
- Property. Assigns the string representing positive infinity.
Params:
| char[] value |
The string representing positive infinity. |
- final char[][]
nativeDigits
();
- Property. Retrieves a string array of native equivalents of the digits 0 to 9.
Returns:
A string array of native equivalents of the digits 0 to 9.
- final void
nativeDigits
(char[][] value);
- Property. Assigns a string array of native equivalents of the digits 0 to 9.
Params:
| char[][] value |
A string array of native equivalents of the digits 0 to 9. |
- class
DateTimeFormat
: tango.text.locale.Core.IFormatService;
-
Determines how Time values are formatted, depending on the culture.
Remarks:
To create a
DateTimeFormat
for a specific culture, create a Culture for that culture and
retrieve its dateTimeFormat property. To create a
DateTimeFormat
for the user's current
culture, use the current property.
- this();
-
Initializes an instance that is writable and culture-independent.
- Object
getFormat
(TypeInfo type);
-
Retrieves an object defining how to format the specified type.
Params:
| TypeInfo type |
The TypeInfo of the resulting formatting object. |
Returns:
If type is typeid(DateTimeFormat), the current DateTimeFormat instance. Otherwise, null.
Remarks:
Implements IFormatService.
getFormat
.
- final char[][]
getAllDateTimePatterns
();
-
Retrieves the standard patterns in which Time values can be formatted.
Returns:
An array of strings containing the standard patterns in which Time values can be formatted.
- final char[][]
getAllDateTimePatterns
(char format);
-
Retrieves the standard patterns in which Time values can be formatted using the specified format character.
Returns:
An array of strings containing the standard patterns in which Time values can be formatted using the specified format character.
- final char[]
getAbbreviatedDayName
(DayOfWeek dayOfWeek);
-
Retrieves the abbreviated name of the specified day of the week based on the culture of the instance.
Params:
| DayOfWeek dayOfWeek |
A DayOfWeek value. |
Returns:
The abbreviated name of the day of the week represented by dayOfWeek.
- final char[]
getDayName
(DayOfWeek dayOfWeek);
-
Retrieves the full name of the specified day of the week based on the culture of the instance.
Params:
| DayOfWeek dayOfWeek |
A DayOfWeek value. |
Returns:
The full name of the day of the week represented by dayOfWeek.
- final char[]
getAbbreviatedMonthName
(int month);
-
Retrieves the abbreviated name of the specified month based on the culture of the instance.
Params:
| int month |
An integer between 1 and 13 indicating the name of the month to return. |
Returns:
The abbreviated name of the month represented by month.
- final char[]
getMonthName
(int month);
-
Retrieves the full name of the specified month based on the culture of the instance.
Params:
| int month |
An integer between 1 and 13 indicating the name of the month to return. |
Returns:
The full name of the month represented by month.
- static DateTimeFormat
getInstance
(IFormatService formatService);
-
Retrieves the DateTimeFormat for the specified IFormatService.
Params:
| IFormatService formatService |
The IFormatService used to retrieve DateTimeFormat. |
Returns:
The DateTimeFormat for the specified IFormatService.
Remarks:
The method calls IFormatService.getFormat with typeof(DateTimeFormat). If formatService is null,
then the value of the current property is returned.
- static DateTimeFormat
current
();
-
Property. Retrieves a read-only DateTimeFormat instance from the
current
culture.
Returns:
A read-only DateTimeFormat instance from the
current
culture.
- static DateTimeFormat
invariantFormat
();
-
Property. Retrieves a read-only DateTimeFormat instance that is culturally independent.
Returns:
A read-only DateTimeFormat instance that is culturally independent.
- final bool
isReadOnly
();
-
Property. Retrieves a value indicating whether the instance is read-only.
Returns:
true is the instance is read-only; otherwise, false.
- final Calendar
calendar
();
- Property. Retrieves the
calendar
used by the current culture.
Returns:
The Calendar determining the
calendar
used by the current culture. For example, the Gregorian.
- final void
calendar
(Calendar value);
-
Property. Assigns the
calendar
to be used by the current culture.
Params:
| Calendar value |
The Calendar determining the
calendar
to be used by the current culture. |
Exceptions:
If value is not valid for the current culture, an Exception is thrown.
- final DayOfWeek
firstDayOfWeek
();
-
Property. Retrieves the first day of the week.
Returns:
A DayOfWeek value indicating the first day of the week.
- final void
firstDayOfWeek
(DayOfWeek value);
- Property. Assigns the first day of the week.
Params:
| valie |
A DayOfWeek value indicating the first day of the week. |
- final WeekRule
calendarWeekRule
();
-
Property. Retrieves the value indicating the rule used to determine the first week of the year.
Returns:
A CalendarWeekRule value determining the first week of the year.
- final void
calendarWeekRule
(WeekRule value);
- Property. Assigns the value indicating the rule used to determine the first week of the year.
Params:
| WeekRule value |
A CalendarWeekRule value determining the first week of the year. |
- final char[]
nativeCalendarName
();
-
Property. Retrieves the native name of the calendar associated with the current instance.
Returns:
The native name of the calendar associated with the current instance.
- final char[]
dateSeparator
();
-
Property. Retrieves the string separating date components.
Returns:
The string separating date components.
- final void
dateSeparator
(char[] value);
- Property. Assigns the string separating date components.
Params:
| char[] value |
The string separating date components. |
- final char[]
timeSeparator
();
-
Property. Retrieves the string separating time components.
Returns:
The string separating time components.
- final void
timeSeparator
(char[] value);
- Property. Assigns the string separating time components.
Params:
| char[] value |
The string separating time components. |
- final char[]
amDesignator
();
-
Property. Retrieves the string designator for hours before noon.
Returns:
The string designator for hours before noon. For example, "AM".
- final void
amDesignator
(char[] value);
- Property. Assigns the string designator for hours before noon.
Params:
| char[] value |
The string designator for hours before noon. |
- final char[]
pmDesignator
();
-
Property. Retrieves the string designator for hours after noon.
Returns:
The string designator for hours after noon. For example, "PM".
- final void
pmDesignator
(char[] value);
- Property. Assigns the string designator for hours after noon.
Params:
| char[] value |
The string designator for hours after noon. |
- final char[]
shortDatePattern
();
-
Property. Retrieves the format pattern for a short date value.
Returns:
The format pattern for a short date value.
- final void
shortDatePattern
(char[] value);
- Property. Assigns the format pattern for a short date value.
Params:
| char[] value |
The format pattern for a short date value. |
- final char[]
shortTimePattern
();
-
Property. Retrieves the format pattern for a short time value.
Returns:
The format pattern for a short time value.
- final void
shortTimePattern
(char[] value);
- Property. Assigns the format pattern for a short time value.
Params:
| char[] value |
The format pattern for a short time value. |
- final char[]
longDatePattern
();
-
Property. Retrieves the format pattern for a long date value.
Returns:
The format pattern for a long date value.
- final void
longDatePattern
(char[] value);
- Property. Assigns the format pattern for a long date value.
Params:
| char[] value |
The format pattern for a long date value. |
- final char[]
longTimePattern
();
-
Property. Retrieves the format pattern for a long time value.
Returns:
The format pattern for a long time value.
- final void
longTimePattern
(char[] value);
- Property. Assigns the format pattern for a long time value.
Params:
| char[] value |
The format pattern for a long time value. |
- final char[]
monthDayPattern
();
-
Property. Retrieves the format pattern for a month and day value.
Returns:
The format pattern for a month and day value.
- final void
monthDayPattern
(char[] value);
- Property. Assigns the format pattern for a month and day value.
Params:
| char[] value |
The format pattern for a month and day value. |
- final char[]
yearMonthPattern
();
-
Property. Retrieves the format pattern for a year and month value.
Returns:
The format pattern for a year and month value.
- final void
yearMonthPattern
(char[] value);
- Property. Assigns the format pattern for a year and month value.
Params:
| char[] value |
The format pattern for a year and month value. |
- final char[][]
abbreviatedDayNames
();
-
Property. Retrieves a string array containing the abbreviated names of the days of the week.
Returns:
A string array containing the abbreviated names of the days of the week. For invariantFormat,
this contains "Sun", "Mon", "Tue", "Wed", "Thu", "Fri" and "Sat".
- final void
abbreviatedDayNames
(char[][] value);
- Property. Assigns a string array containing the abbreviated names of the days of the week.
Params:
| char[][] value |
A string array containing the abbreviated names of the days of the week. |
- final char[][]
dayNames
();
-
Property. Retrieves a string array containing the full names of the days of the week.
Returns:
A string array containing the full names of the days of the week. For invariantFormat,
this contains "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" and "Saturday".
- final void
dayNames
(char[][] value);
- Property. Assigns a string array containing the full names of the days of the week.
Params:
| char[][] value |
A string array containing the full names of the days of the week. |
- final char[][]
abbreviatedMonthNames
();
-
Property. Retrieves a string array containing the abbreviated names of the months.
Returns:
A string array containing the abbreviated names of the months. For invariantFormat,
this contains "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" and "".
- final void
abbreviatedMonthNames
(char[][] value);
- Property. Assigns a string array containing the abbreviated names of the months.
Params:
| char[][] value |
A string array containing the abbreviated names of the months. |
- final char[][]
monthNames
();
-
Property. Retrieves a string array containing the full names of the months.
Returns:
A string array containing the full names of the months. For invariantFormat,
this contains "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" and "".
- final void
monthNames
(char[][] value);
- Property. Assigns a string array containing the full names of the months.
Params:
| char[][] value |
A string array containing the full names of the months. |
- final char[]
fullDateTimePattern
();
-
Property. Retrieves the format pattern for a long date and a long time value.
Returns:
The format pattern for a long date and a long time value.
- final void
fullDateTimePattern
(char[] value);
- Property. Assigns the format pattern for a long date and a long time value.
Params:
| char[] value |
The format pattern for a long date and a long time value. |
- final char[]
rfc1123Pattern
();
-
Property. Retrieves the format pattern based on the IETF RFC 1123 specification, for a time value.
Returns:
The format pattern based on the IETF RFC 1123 specification, for a time value.
- final char[]
sortableDateTimePattern
();
-
Property. Retrieves the format pattern for a sortable date and time value.
Returns:
The format pattern for a sortable date and time value.
- final char[]
universalSortableDateTimePattern
();
-
Property. Retrieves the format pattern for a universal date and time value.
Returns:
The format pattern for a universal date and time value.
|