tango.text.locale.Core

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.

Interface Description
IFormatService Retrieves an object to control formatting.

Class Description
Calendar Represents time in week, month and year divisions.
Culture Provides information about a culture, such as its name, calendar and date and number format patterns.
DateTimeFormat Determines how Time values are formatted, depending on the culture.
DaylightSavingTime Represents a period of daylight-saving time.
Gregorian Represents the Gregorian calendar.
Hebrew Represents the Hebrew calendar.
Hijri Represents the Hijri calendar.
Japanese Represents the Japanese calendar.
Korean Represents the Korean calendar.
NumberFormat Determines how numbers are formatted, according to the current culture.
Region Provides information about a region.
Taiwan Represents the Taiwan calendar.
ThaiBuddhist Represents the Thai Buddhist calendar.

Struct Description
Time Represents time expressed as a date and time of day.
TimeSpan Represents a time interval.
enum CultureTypes [public]
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(T) [public]
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.
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.

Parameters:

typeAn object that specifies the _type of formatting to retrieve.
class Culture : IFormatService [public]
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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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(const(char)[] cultureName) [public]
Initializes a new Culture instance from the supplied name.

Parameters:

cultureNameThe name of the Culture.
this(int cultureID) [public]
Initializes a new Culture instance from the supplied culture identifier.

Parameters:

cultureIDThe identifer (LCID) of the Culture.

Remarks:

Culture identifiers correspond to a Windows LCID.
Object getFormat(TypeInfo type) [public]
Retrieves an object defining how to format the specified type.

Parameters:

typeThe 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:

Culture getCulture(int cultureID) [public, static]
Returns a read-only instance of a culture using the specified culture identifier.

Parameters:

cultureIDThe identifier of the culture.

Returns:

A read-only culture instance.

Remarks:

Instances returned by this method are cached.
Culture getCulture(const(char)[] cultureName) [public, static]
Returns a read-only instance of a culture using the specified culture name.

Parameters:

cultureNameThe name of the culture.

Returns:

A read-only culture instance.

Remarks:

Instances returned by this method are cached.
Culture getCultureFromIetfLanguageTag(const(char)[] name) [public, static]
Returns a read-only instance using the specified name, as defined by the RFC 3066 standard and maintained by the IETF.

Parameters:

nameThe name of the language.

Returns:

A read-only culture instance.
Culture[] getCultures(CultureTypes types) [public, static]
Returns a list of cultures filtered by the specified CultureTypes.

Parameters:

typesA combination of CultureTypes.

Returns:

An array of Culture instances containing cultures specified by types.
immutable(char)[] toString() [public, override]
Returns the name of the Culture.

Returns:

A string containing the name of the Culture in the format <language>"-"<region>.
Culture current() [public, @property, static]
Property. Retrieves the culture of the current user.

Returns:

The Culture instance representing the user's current culture.
void current(Culture value) [public, @property, static]
Property. Assigns the culture of the _current user.

Parameters:

valueThe Culture instance representing the user's _current culture.

Examples:

The following examples shows how to change the _current culture.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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).
Culture invariantCulture() [public, @property, static]
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() [public, @property, const]
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.
const(char)[] name() [public, @property, const]
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".
const(char)[] englishName() [public, @property, const]
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)".
const(char)[] nativeName() [public, @property, const]
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)".
const(char)[] twoLetterLanguageName() [public, @property, const]
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".
const(char)[] threeLetterLanguageName() [public, @property, const]
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".
const(char)[] ietfLanguageTag() [public, @property, final, const]
Property. Retrieves the RFC 3066 identification for a language.

Returns:

A string representing the RFC 3066 language identification.
Culture parent() [public, @property]
Property. Retrieves the Culture representing the parent of the current instance.

Returns:

The Culture representing the parent of the current instance.
bool isNeutral() [public, @property, const]
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
bool isReadOnly() [public, @property, final, const]
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() [public, @property]
Property. Retrieves the calendar used by the culture.

Returns:

A Calendar instance respresenting the calendar used by the culture.
Calendar[] optionalCalendars() [public, @property]
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() [public, @property]
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) [public, @property]
Property. Assigns a NumberFormat defining the culturally appropriate format for displaying numbers and currency.

Parameters:

valuesA NumberFormat defining the culturally appropriate format for displaying numbers and currency.
DateTimeFormat dateTimeFormat() [public, @property]
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) [public, @property]
Property. Assigns a DateTimeFormat defining the culturally appropriate format for displaying dates and times.

Parameters:

valuesA DateTimeFormat defining the culturally appropriate format for displaying dates and times.
class Region [public]
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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) [public]
Initializes a new Region instance based on the region associated with the specified culture identifier.

Parameters:

cultureIDA culture indentifier.

Remarks:

The name of the Region instance is set to the ISO 3166 two-letter code for that region.
this(const(char)[] name) [public]
Initializes a new Region instance based on the region specified by name.

Parameters:

nameA two-letter ISO 3166 code for the region. Or, a culture _name consisting of the language and region.
Region current() [public, @property, static]
Property. Retrieves the Region used by the current Culture.

Returns:

The Region instance associated with the current Culture.
int geoID() [public, @property, const]
Property. Retrieves a unique identifier for the geographical location of the region.

Returns:

An int uniquely identifying the geographical location.
const(char)[] name() [public, @property, const]
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.
const(char)[] englishName() [public, @property, const]
Property. Retrieves the full name of the region in English.

Returns:

The full name of the region in English.
const(char)[] nativeName() [public, @property, const]
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.
const(char)[] twoLetterRegionName() [public, @property, const]
Property. Retrieves the two-letter ISO 3166 code of the region.

Returns:

The two-letter ISO 3166 code of the region.
const(char)[] threeLetterRegionName() [public, @property, const]
Property. Retrieves the three-letter ISO 3166 code of the region.

Returns:

The three-letter ISO 3166 code of the region.
const(char)[] currencySymbol() [public, @property, const]
Property. Retrieves the currency symbol of the region.

Returns:

The currency symbol of the region.
const(char)[] isoCurrencySymbol() [public, @property, const]
Property. Retrieves the three-character currency symbol of the region.

Returns:

The three-character currency symbol of the region.
const(char)[] currencyEnglishName() [public, @property, const]
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.
const(char)[] currencyNativeName() [public, @property, const]
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() [public, @property, const]
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.
immutable(char)[] toString() [public, override]
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 : IFormatService [public]
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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() [public]
Initializes a new, culturally independent instance.

Remarks:

Modify the properties of the new instance to define custom formatting.
Object getFormat(TypeInfo type) [public]
Retrieves an object defining how to format the specified type.

Parameters:

typeThe TypeInfo of the resulting formatting object.

Returns:

If type is typeid(NumberFormat), the current NumberFormat instance. Otherwise, null.

Remarks:

NumberFormat getInstance(IFormatService formatService) [public, static]
Retrieves the NumberFormat for the specified IFormatService.

Parameters:

formatServiceThe 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.
NumberFormat current() [public, @property, static]
Property. Retrieves a read-only NumberFormat instance from the current culture.

Returns:

A read-only NumberFormat instance from the current culture.
NumberFormat invariantFormat() [public, static]
Property. Retrieves the read-only, culturally independent NumberFormat instance.

Returns:

The read-only, culturally independent NumberFormat instance.
bool isReadOnly() [public, @property, final, const]
Property. Retrieves a value indicating whether the instance is read-only.

Returns:

true if the instance is read-only; otherwise, false.
int numberDecimalDigits() [public, @property, final, const]
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.
void numberDecimalDigits(int value) [public, @property, final]
Assigns the number of decimal digits used for numbers.

Parameters:

valueThe 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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
int numberNegativePattern() [public, @property, final, const]
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.

ValuePattern
0(n)
1-n
2- n
3n-
4n -
void numberNegativePattern(int value) [public, @property, final]
Property. Assigns the format pattern for negative numbers.

Parameters:

valueThe format pattern for negative numbers.

Examples:

The following example shows the effect of the different patterns.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 -
int currencyDecimalDigits() [public, @property, final, const]
Property. Retrieves the number of decimal places to use in currency values.

Returns:

The number of decimal digits to use in currency values.
void currencyDecimalDigits(int value) [public, @property, final]
Property. Assigns the number of decimal places to use in currency values.

Parameters:

valueThe number of decimal digits to use in currency values.
int currencyNegativePattern() [public, @property, final, const]
Property. Retrieves the formal pattern to use for negative currency values.

Returns:

The format pattern to use for negative currency values.
void currencyNegativePattern(int value) [public, @property, final]
Property. Assigns the formal pattern to use for negative currency values.

Parameters:

valueThe format pattern to use for negative currency values.
int currencyPositivePattern() [public, @property, final, const]
Property. Retrieves the formal pattern to use for positive currency values.

Returns:

The format pattern to use for positive currency values.
void currencyPositivePattern(int value) [public, @property, final]
Property. Assigns the formal pattern to use for positive currency values.

Returns:

The format pattern to use for positive currency values.
const(int)[] numberGroupSizes() [public, @property, final, const]
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.
void numberGroupSizes(const(int)[] value) [public, @property, final]
Property. Assigns the number of digits int each group to the left of the decimal place in numbers.

Parameters:

valueThe number of digits int each group to the left of the decimal place in numbers.
const(int)[] currencyGroupSizes() [public, @property, final, const]
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.
void currencyGroupSizes(const(int)[] value) [public, @property, final]
Property. Assigns the number of digits int each group to the left of the decimal place in currency values.

Parameters:

valueThe number of digits int each group to the left of the decimal place in currency values.
const(char)[] numberGroupSeparator() [public, @property, final, const]
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, ",".
void numberGroupSeparator(const(char)[] value) [public, @property, final]
Property. Assigns the string separating groups of digits to the left of the decimal place in numbers.

Parameters:

valueThe string separating groups of digits to the left of the decimal place in numbers.
const(char)[] numberDecimalSeparator() [public, @property, final, const]
Property. Retrieves the string used as the decimal separator in numbers.

Returns:

The string used as the decimal separator in numbers. For example, ".".
void numberDecimalSeparator(const(char)[] value) [public, @property, final]
Property. Assigns the string used as the decimal separator in numbers.

Parameters:

valueThe string used as the decimal separator in numbers.
const(char)[] currencyGroupSeparator() [public, @property, final, const]
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, ",".
void currencyGroupSeparator(const(char)[] value) [public, @property, final]
Property. Assigns the string separating groups of digits to the left of the decimal place in currency values.

Parameters:

valueThe string separating groups of digits to the left of the decimal place in currency values.
const(char)[] currencyDecimalSeparator() [public, @property, final, const]
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, ".".
void currencyDecimalSeparator(const(char)[] value) [public, @property, final]
Property. Assigns the string used as the decimal separator in currency values.

Parameters:

valueThe string used as the decimal separator in currency values.
const(char)[] currencySymbol() [public, @property, final, const]
Property. Retrieves the string used as the currency symbol.

Returns:

The string used as the currency symbol. For example, "£".
void currencySymbol(const(char)[] value) [public, @property, final]
Property. Assigns the string used as the currency symbol.

Parameters:

valueThe string used as the currency symbol.
const(char)[] negativeSign() [public, @property, final, const]
Property. Retrieves the string denoting that a number is negative.

Returns:

The string denoting that a number is negative. For example, "-".
void negativeSign(const(char)[] value) [public, @property, final]
Property. Assigns the string denoting that a number is negative.

Parameters:

valueThe string denoting that a number is negative.
const(char)[] positiveSign() [public, @property, final, const]
Property. Retrieves the string denoting that a number is positive.

Returns:

The string denoting that a number is positive. For example, "+".
void positiveSign(const(char)[] value) [public, @property, final]
Property. Assigns the string denoting that a number is positive.

Parameters:

valueThe string denoting that a number is positive.
const(char)[] nanSymbol() [public, @property, final, const]
Property. Retrieves the string representing the NaN (not a number) value.

Returns:

The string representing the NaN value. For example, "NaN".
void nanSymbol(const(char)[] value) [public, @property, final]
Property. Assigns the string representing the NaN (not a number) value.

Parameters:

valueThe string representing the NaN value.
const(char)[] negativeInfinitySymbol() [public, @property, final, const]
Property. Retrieves the string representing negative infinity.

Returns:

The string representing negative infinity. For example, "-Infinity".
void negativeInfinitySymbol(const(char)[] value) [public, @property, final]
Property. Assigns the string representing negative infinity.

Parameters:

valueThe string representing negative infinity.
const(char)[] positiveInfinitySymbol() [public, @property, final, const]
Property. Retrieves the string representing positive infinity.

Returns:

The string representing positive infinity. For example, "Infinity".
void positiveInfinitySymbol(const(char)[] value) [public, @property, final]
Property. Assigns the string representing positive infinity.

Parameters:

valueThe string representing positive infinity.
const(char[])[] nativeDigits() [public, @property, final, const]
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.
void nativeDigits(const(char[])[] value) [public, @property, final]
Property. Assigns a string array of native equivalents of the digits 0 to 9.

Parameters:

valueA string array of native equivalents of the digits 0 to 9.
class DateTimeFormat : IFormatService [public]
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() [package]
Initializes an instance that is writable and culture-independent.
Object getFormat(TypeInfo type) [public]
Retrieves an object defining how to format the specified type.

Parameters:

typeThe TypeInfo of the resulting formatting object.

Returns:

If type is typeid(DateTimeFormat), the current DateTimeFormat instance. Otherwise, null.

Remarks:

const(char)[][] getAllDateTimePatterns() [public, final]
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.
const(char)[][] getAllDateTimePatterns(char format) [public, final]
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.
const(char)[] getAbbreviatedDayName(Calendar.DayOfWeek dayOfWeek) [public, final]
Retrieves the abbreviated name of the specified day of the week based on the culture of the instance.

Parameters:

dayOfWeekA DayOfWeek value.

Returns:

The abbreviated name of the day of the week represented by dayOfWeek.
const(char)[] getDayName(Calendar.DayOfWeek dayOfWeek) [public, final]
Retrieves the full name of the specified day of the week based on the culture of the instance.

Parameters:

dayOfWeekA DayOfWeek value.

Returns:

The full name of the day of the week represented by dayOfWeek.
const(char)[] getAbbreviatedMonthName(int month) [public, final]
Retrieves the abbreviated name of the specified month based on the culture of the instance.

Parameters:

monthAn integer between 1 and 13 indicating the name of the _month to return.

Returns:

The abbreviated name of the _month represented by month.
const(char)[] getMonthName(int month) [public, final]
Retrieves the full name of the specified month based on the culture of the instance.

Parameters:

monthAn integer between 1 and 13 indicating the name of the _month to return.

Returns:

The full name of the _month represented by month.
DateTimeFormat getInstance(IFormatService formatService) [public, static]
Retrieves the DateTimeFormat for the specified IFormatService.

Parameters:

formatServiceThe 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.
DateTimeFormat current() [public, @property, static]
Property. Retrieves a read-only DateTimeFormat instance from the current culture.

Returns:

A read-only DateTimeFormat instance from the current culture.
DateTimeFormat invariantFormat() [public, static]
Property. Retrieves a read-only DateTimeFormat instance that is culturally independent.

Returns:

A read-only DateTimeFormat instance that is culturally independent.
bool isReadOnly() [public, @property, final]
Property. Retrieves a value indicating whether the instance is read-only.

Returns:

true is the instance is read-only; otherwise, false.
Calendar calendar() [public, @property, final]
Property. Retrieves the calendar used by the current culture.

Returns:

The Calendar determining the calendar used by the current culture. For example, the Gregorian.
void calendar(Calendar value) [public, @property, final]
Property. Assigns the calendar to be used by the current culture.

Parameters:

valueThe 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.
Calendar.DayOfWeek firstDayOfWeek() [public, @property, final]
Property. Retrieves the first day of the week.

Returns:

A DayOfWeek value indicating the first day of the week.
void firstDayOfWeek(Calendar.DayOfWeek value) [public, @property, final]
Property. Assigns the first day of the week.

Parameters:

valieA DayOfWeek value indicating the first day of the week.
Calendar.WeekRule calendarWeekRule() [public, @property, final]
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.
void calendarWeekRule(Calendar.WeekRule value) [public, @property, final]
Property. Assigns the _value indicating the rule used to determine the first week of the year.

Parameters:

valueA CalendarWeekRule _value determining the first week of the year.
const(char)[] nativeCalendarName() [public, @property, final]
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.
const(char)[] dateSeparator() [public, @property, final]
Property. Retrieves the string separating date components.

Returns:

The string separating date components.
void dateSeparator(const(char)[] value) [public, @property, final]
Property. Assigns the string separating date components.

Parameters:

valueThe string separating date components.
const(char)[] timeSeparator() [public, @property, final]
Property. Retrieves the string separating time components.

Returns:

The string separating time components.
void timeSeparator(const(char)[] value) [public, @property, final]
Property. Assigns the string separating time components.

Parameters:

valueThe string separating time components.
const(char)[] amDesignator() [public, @property, final]
Property. Retrieves the string designator for hours before noon.

Returns:

The string designator for hours before noon. For example, "AM".
void amDesignator(const(char)[] value) [public, @property, final]
Property. Assigns the string designator for hours before noon.

Parameters:

valueThe string designator for hours before noon.
const(char)[] pmDesignator() [public, @property, final]
Property. Retrieves the string designator for hours after noon.

Returns:

The string designator for hours after noon. For example, "PM".
void pmDesignator(const(char)[] value) [public, @property, final]
Property. Assigns the string designator for hours after noon.

Parameters:

valueThe string designator for hours after noon.
const(char)[] shortDatePattern() [public, @property, final]
Property. Retrieves the format pattern for a short date value.

Returns:

The format pattern for a short date value.
void shortDatePattern(const(char)[] value) [public, @property, final]
Property. Assigns the format pattern for a short date _value.

Parameters:

valueThe format pattern for a short date _value.
const(char)[] shortTimePattern() [public, @property, final]
Property. Retrieves the format pattern for a short time value.

Returns:

The format pattern for a short time value.
void shortTimePattern(const(char)[] value) [public, @property, final]
Property. Assigns the format pattern for a short time _value.

Parameters:

valueThe format pattern for a short time _value.
const(char)[] longDatePattern() [public, @property, final]
Property. Retrieves the format pattern for a long date value.

Returns:

The format pattern for a long date value.
void longDatePattern(const(char)[] value) [public, @property, final]
Property. Assigns the format pattern for a long date _value.

Parameters:

valueThe format pattern for a long date _value.
const(char)[] longTimePattern() [public, @property, final]
Property. Retrieves the format pattern for a long time value.

Returns:

The format pattern for a long time value.
void longTimePattern(const(char)[] value) [public, @property, final]
Property. Assigns the format pattern for a long time _value.

Parameters:

valueThe format pattern for a long time _value.
const(char)[] monthDayPattern() [public, @property, final]
Property. Retrieves the format pattern for a month and day value.

Returns:

The format pattern for a month and day value.
void monthDayPattern(const(char)[] value) [public, @property, final]
Property. Assigns the format pattern for a month and day _value.

Parameters:

valueThe format pattern for a month and day _value.
const(char)[] yearMonthPattern() [public, @property, final]
Property. Retrieves the format pattern for a year and month value.

Returns:

The format pattern for a year and month value.
void yearMonthPattern(const(char)[] value) [public, @property, final]
Property. Assigns the format pattern for a year and month _value.

Parameters:

valueThe format pattern for a year and month _value.
const(char)[][] abbreviatedDayNames() [public, @property, final]
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".
void abbreviatedDayNames(const(char)[][] value) [public, @property, final]
Property. Assigns a string array containing the abbreviated names of the days of the week.

Parameters:

valueA string array containing the abbreviated names of the days of the week.
const(char)[][] dayNames() [public, @property, final]
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".
void dayNames(const(char)[][] value) [public, @property, final]
Property. Assigns a string array containing the full names of the days of the week.

Parameters:

valueA string array containing the full names of the days of the week.
const(char)[][] abbreviatedMonthNames() [public, @property, final]
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 "".
void abbreviatedMonthNames(const(char)[][] value) [public, @property, final]
Property. Assigns a string array containing the abbreviated names of the months.

Parameters:

valueA string array containing the abbreviated names of the months.
const(char)[][] monthNames() [public, @property, final]
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 "".
void monthNames(const(char)[][] value) [public, @property, final]
Property. Assigns a string array containing the full names of the months.

Parameters:

valueA string array containing the full names of the months.
const(char)[] fullDateTimePattern() [public, @property, final]
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.
void fullDateTimePattern(const(char)[] value) [public, @property, final]
Property. Assigns the format pattern for a long date and a long time _value.

Parameters:

valueThe format pattern for a long date and a long time _value.
const(char)[] rfc1123Pattern() [public, @property, final, const]
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.
const(char)[] sortableDateTimePattern() [public, @property, final, const]
Property. Retrieves the format pattern for a sortable date and time value.

Returns:

The format pattern for a sortable date and time value.
const(char)[] universalSortableDateTimePattern() [public, @property, final, const]
Property. Retrieves the format pattern for a universal date and time value.

Returns:

The format pattern for a universal date and time value.