## Class DateTimeFormatInfo

Description

Defines how DateTime values are formatted and displayed, depending on the culture.

This class contains information, such as date patterns, time patterns, and AM/PM designators.

To create a DateTimeFormatInfo for a specific culture, create a CultureInfo for that culture and retrieve the CultureInfo.DateTimeFormat property. For example:

     $culture = new CultureInfo('en_AU');
     $dtfi = $culture->DateTimeFormat;

To create a DateTimeFormatInfo for the invariant culture, use

     DateTimeFormatInfo::getInstance($culture=null);

you may pass a CultureInfo parameter $culture to get the DateTimeFormatInfo for a specific culture.

DateTime values are formatted using standard or custom patterns stored in the properties of a DateTimeFormatInfo.

The standard patterns can be replaced with custom patterns by setting the associated properties of DateTimeFormatInfo.

The following table lists the standard format characters for each standard pattern and the associated DateTimeFormatInfo property that can be set to modify the standard pattern. The format characters are case-sensitive; for example, 'g' and 'G' represent slightly different patterns.

      Format Character    Associated Property     Example Format Pattern (en-US)
      --------------------------------------------------------------------------
      d                   ShortDatePattern        MM/dd/yyyy
      D                   LongDatePattern         dddd, dd MMMM yyyy
      F                   FullDateTimePattern     dddd, dd MMMM yyyy HH:mm:ss
      m, M                MonthDayPattern         MMMM dd
      r, R                RFC1123Pattern          ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
      s                   SortableDateTimePattern yyyy'-'MM'-'dd'T'HH':'mm':'ss
      t                   ShortTimePattern        HH:mm
      T                   LongTimePattern         HH:mm:ss
      Y                   YearMonthPattern        yyyy MMMM
      --------------------------------------------------------------------------

- version: v1.0, last update on Fri Dec 03 22:30:31 EST 2004
- author: Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>

Located in /I18N/core/DateTimeFormatInfo.php (line 78)

Variable Summary
array $properties
Method Summary
DateTimeFormatInfo __construct ([array $data = array()])
string formatDateTime (mixed $date, mixed $time)
array getAbbreviatedDayNames ()
array getAbbreviatedMonthNames ()
string getAMDesignator ()
array getAMPMMarkers ()
array getData ()
string getDateTimeOrderPattern ()
array getDayNames ()
string getEra (int $era)
string getFullDatePattern ()
string getFullTimePattern ()
DateTimeFormatInfo getInstance ([CultureInfo $culture = null])
DateTimeFormatInfo getInvariantInfo ()
string getLongDatePattern ()
string getLongTimePattern ()
string getMediumDatePattern ()
string getMediumTimePattern ()
array getMonthNames ()
array getNarrowDayNames ()
array getNarrowMonthNames ()
string getPMDesignator ()
string getShortDatePattern ()
string getShortTimePattern ()
void setAbbreviatedDayNames (array $value)
void setAbbreviatedMonthNames (array $value)
void setAMDesignator (string $value)
void setAMPMMarkers (array $value)
void setDayNames (array $value)
void setMonthNames (array $value)
void setNarrowDayNames (array $value)
void setNarrowMonthNames (array $value)
void setPMDesignator (string $value)
mixed __get (mixed $name)
void __set (mixed $name, mixed $value)
Variables
array $properties = array() (line 90)

A list of properties that are accessable/writable.

- access: protected

Methods
Constructor __construct (line 128)

Initializes a new writable instance of the DateTimeFormatInfo class

that is dependent on the ICU data for date time formatting information. N.B.You should not initialize this class directly unless you know what you are doing. Please use use DateTimeFormatInfo::getInstance() to create an instance.

- see: DateTimeFormatInfo::getInstance()

DateTimeFormatInfo __construct ([array $data = array()])

- array $data: ICU data for date time formatting.

formatDateTime (line 506)

Formats the date and time in a culture sensitive paterrn.

The default is "Date Time".

- return: date and time formated

string formatDateTime (mixed $date, mixed $time)
getAbbreviatedDayNames (line 193)

A one-dimensional array of type String containing the culture-specific abbreviated names of the days of the week. The array for InvariantInfo contains "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", and "Sat".

- return: abbreviated day names

array getAbbreviatedDayNames ()
getAbbreviatedMonthNames (line 292)

A one-dimensional array of type String containing the culture-specific abbreviated names of the months. The array for InvariantInfo contains "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", and "Dec".

- return: abbreviated month names.

array getAbbreviatedMonthNames ()
getAMDesignator (line 352)

The string designator for hours that are "ante meridiem" (before noon).

The default for InvariantInfo is "AM".

- return: AM designator.

string getAMDesignator ()
getAMPMMarkers (line 396)

Get the AM and PM markers array.

Default InvariantInfo for AM and PM is

    array('AM','PM');

- return: AM and PM markers

array getAMPMMarkers ()
getData (line 142)

Get the internal ICU data for date time formatting.

- return: ICU date time formatting data.
- access: protected

array getData ()
getDateTimeOrderPattern (line 496)

Returns the date time order pattern, "{1} {0}" (default).

This is culture sensitive.

- return: pattern "{1} {0}".

string getDateTimeOrderPattern ()
getDayNames (line 242)

A one-dimensional array of type String containing the culture-specific full names of the days of the week.

The array for InvariantInfo contains "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and "Saturday".

- return: day names

array getDayNames ()
getEra (line 341)

A string containing the name of the era.

- return: the era name.

string getEra (int $era)

- int $era: era The integer representing the era.

getFullDatePattern (line 456)

Returns the full date pattern "EEEE, yyyy MMMM dd" (default).

This is culture sensitive.

- return: pattern "EEEE, yyyy MMMM dd".

string getFullDatePattern ()
getFullTimePattern (line 416)

Returns the full time pattern "HH:mm:ss z" (default).

This is culture sensitive.

- return: pattern "HH:mm:ss z".

string getFullTimePattern ()
getInstance (line 169)

Returns the DateTimeFormatInfo associated with the specified culture.

- return: DateTimeFormatInfo for the specified culture.

DateTimeFormatInfo getInstance ([CultureInfo $culture = null])

- CultureInfo $culture: the culture that gets the DateTimeFormat property.

getInvariantInfo (line 152)

Gets the default DateTimeFormatInfo that is culture-independent (invariant).

- return: default DateTimeFormatInfo.
- static:

DateTimeFormatInfo getInvariantInfo ()
getLongDatePattern (line 466)

Returns the long date pattern "yyyy MMMM d" (default).

This is culture sensitive.

- return: pattern "yyyy MMMM d".

string getLongDatePattern ()
getLongTimePattern (line 426)

Returns the long time pattern "HH:mm:ss z" (default).

This is culture sensitive.

- return: pattern "HH:mm:ss z".

string getLongTimePattern ()
getMediumDatePattern (line 476)

Returns the medium date pattern "yyyy MMMM d" (default).

This is culture sensitive.

- return: pattern "yyyy MMM d".

string getMediumDatePattern ()
getMediumTimePattern (line 436)

Returns the medium time pattern "HH:mm:ss" (default).

This is culture sensitive.

- return: pattern "HH:mm:ss".

string getMediumTimePattern ()
getMonthNames (line 318)

A one-dimensional array of type String containing the

culture-specific full names of the months. The array for InvariantInfo contains "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", and "December"

- return: month names.

array getMonthNames ()
getNarrowDayNames (line 218)

A one-dimensional array of type String containing the culture-specific narrow names of the days of the week. The array for InvariantInfo contains "S", "M", "T", "W", "T", "F", and "S".

- return: narrow day names

array getNarrowDayNames ()
getNarrowMonthNames (line 268)

A one-dimensional array of type String containing the culture-specific narrow names of the months. The array for InvariantInfo contains "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", and "D".

- return: narrow month names.

array getNarrowMonthNames ()
getPMDesignator (line 374)

The string designator for hours that are "post meridiem" (after noon).

The default for InvariantInfo is "PM".

- return: PM designator.

string getPMDesignator ()
getShortDatePattern (line 486)

Returns the short date pattern "yy/MM/dd" (default).

This is culture sensitive.

- return: pattern "yy/MM/dd".

string getShortDatePattern ()
getShortTimePattern (line 446)

Returns the short time pattern "HH:mm" (default).

This is culture sensitive.

- return: pattern "HH:mm".

string getShortTimePattern ()
setAbbreviatedDayNames (line 206)

Set the abbreviated day names. The value should be an array of string starting with Sunday and ends in Saturady.

For example,

    array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");

void setAbbreviatedDayNames (array $value)

- array $value: abbreviated day names.

setAbbreviatedMonthNames (line 305)

Set the abbreviated month names. The value should be an array of string starting with Jan and ends in Dec.

For example,

    array("Jan", "Feb", "Mar", "Apr", "May", "Jun",
     "Jul", "Aug", "Sep","Oct","Nov","Dec");

void setAbbreviatedMonthNames (array $value)

- array $value: month names.

setAMDesignator (line 362)

Set the AM Designator. For example, 'AM'.

void setAMDesignator (string $value)

- string $value: AM designator.

setAMPMMarkers (line 406)

Set the AM and PM markers array.

For example

    array('AM','PM');

void setAMPMMarkers (array $value)

- array $value: AM and PM markers

setDayNames (line 256)

Set the day names. The value should be an array of string starting with Sunday and ends in Saturady.

For example,

    array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
     "Friday", "Saturday".);

void setDayNames (array $value)

- array $value: day names.

setMonthNames (line 331)

Set the month names. The value should be an array of string starting with Janurary and ends in December.

For example,

    array("January", "February", "March", "April", "May", "June",
     "July", "August", "September","October","November","December");

void setMonthNames (array $value)

- array $value: month names.

setNarrowDayNames (line 230)

Set the narrow day names. The value should be an array of string starting with Sunday and ends in Saturady.

For example,

    array("S", "M", "T", "W", "T", "F", "S");

void setNarrowDayNames (array $value)

- array $value: narrow day names.

setNarrowMonthNames (line 280)

Set the narrow month names. The value should be an array of string starting with J and ends in D.

For example,

    array("J","F","M","A","M","J","J","A","S","O","N","D");

void setNarrowMonthNames (array $value)

- array $value: month names.

setPMDesignator (line 384)

Set the PM Designator. For example, 'PM'.

void setPMDesignator (string $value)

- string $value: PM designator.

__get (line 97)

Allow functions that begins with 'set' to be called directly as an attribute/property to retrieve the value.

mixed __get (mixed $name)
__set (line 110)

Allow functions that begins with 'set' to be called directly as an attribute/property to set the value.

void __set (mixed $name, mixed $value)

Documentation generated on Mon, 01 May 2006 23:02:35 -0400 by phpDocumentor 1.3.0RC4