System.I18N.core
[ class tree: System.I18N.core ] [ index: System.I18N.core ] [ all elements ]

Class: DateTimeFormatInfo

Source Location: /I18N/core/DateTimeFormatInfo.php

Class Overview


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

Class Details

[line 78]
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:

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

To create a DateTimeFormatInfo for the invariant culture, use

  1. 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.

  1. Format Character Associated Property Example Format Pattern (en-US)
  2. --------------------------------------------------------------------------
  3. d ShortDatePattern MM/dd/yyyy
  4. D LongDatePattern dddd, dd MMMM yyyy
  5. F FullDateTimePattern dddd, dd MMMM yyyy HH:mm:ss
  6. m, M MonthDayPattern MMMM dd
  7. r, R RFC1123Pattern ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
  8. s SortableDateTimePattern yyyy'-'MM'-'dd'T'HH':'mm':'ss
  9. t ShortTimePattern HH:mm
  10. T LongTimePattern HH:mm:ss
  11. Y YearMonthPattern yyyy MMMM
  12. --------------------------------------------------------------------------




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


[ Top ]

Variables

Methods



Class Variables

$properties = array()

[line 90]

A list of properties that are accessable/writable.



access:  protected

Type:   array


[ Top ]



Class Methods


constructor __construct [line 128]

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

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.






Parameters:

array   $data   ICU data for date time formatting.

[ Top ]

method formatDateTime [line 506]

string formatDateTime( mixed $date, mixed $time)

Formats the date and time in a culture sensitive paterrn.

The default is "Date Time".




return:  date and time formated


[ Top ]

method getAbbreviatedDayNames [line 193]

array getAbbreviatedDayNames( )

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


[ Top ]

method getAbbreviatedMonthNames [line 292]

array getAbbreviatedMonthNames( )

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.


[ Top ]

method getAMDesignator [line 352]

string getAMDesignator( )

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

The default for InvariantInfo is "AM".




return:  AM designator.


[ Top ]

method getAMPMMarkers [line 396]

array getAMPMMarkers( )

Get the AM and PM markers array.

Default InvariantInfo for AM and PM is

  1. array('AM','PM');




return:  AM and PM markers


[ Top ]

method getData [line 142]

array getData( )

Get the internal ICU data for date time formatting.



return:  ICU date time formatting data.
access:  protected


[ Top ]

method getDateTimeOrderPattern [line 496]

string getDateTimeOrderPattern( )

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

This is culture sensitive.




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


[ Top ]

method getDayNames [line 242]

array getDayNames( )

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


[ Top ]

method getEra [line 341]

string getEra( int $era)

A string containing the name of the era.



return:  the era name.


Parameters:

int   $era   era The integer representing the era.

[ Top ]

method getFullDatePattern [line 456]

string getFullDatePattern( )

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

This is culture sensitive.




return:  pattern "EEEE, yyyy MMMM dd".


[ Top ]

method getFullTimePattern [line 416]

string getFullTimePattern( )

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

This is culture sensitive.




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


[ Top ]

method getInstance [line 169]

DateTimeFormatInfo getInstance( [CultureInfo $culture = null])

Returns the DateTimeFormatInfo associated with the specified culture.



return:  DateTimeFormatInfo for the specified culture.


Parameters:

CultureInfo   $culture   the culture that gets the DateTimeFormat property.

[ Top ]

method getInvariantInfo [line 152]

DateTimeFormatInfo getInvariantInfo( )

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



return:  default DateTimeFormatInfo.
static:  


[ Top ]

method getLongDatePattern [line 466]

string getLongDatePattern( )

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

This is culture sensitive.




return:  pattern "yyyy MMMM d".


[ Top ]

method getLongTimePattern [line 426]

string getLongTimePattern( )

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

This is culture sensitive.




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


[ Top ]

method getMediumDatePattern [line 476]

string getMediumDatePattern( )

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

This is culture sensitive.




return:  pattern "yyyy MMM d".


[ Top ]

method getMediumTimePattern [line 436]

string getMediumTimePattern( )

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

This is culture sensitive.




return:  pattern "HH:mm:ss".


[ Top ]

method getMonthNames [line 318]

array getMonthNames( )

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.


[ Top ]

method getNarrowDayNames [line 218]

array getNarrowDayNames( )

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


[ Top ]

method getNarrowMonthNames [line 268]

array getNarrowMonthNames( )

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.


[ Top ]

method getPMDesignator [line 374]

string getPMDesignator( )

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

The default for InvariantInfo is "PM".




return:  PM designator.


[ Top ]

method getShortDatePattern [line 486]

string getShortDatePattern( )

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

This is culture sensitive.




return:  pattern "yy/MM/dd".


[ Top ]

method getShortTimePattern [line 446]

string getShortTimePattern( )

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

This is culture sensitive.




return:  pattern "HH:mm".


[ Top ]

method setAbbreviatedDayNames [line 206]

void setAbbreviatedDayNames( array $value)

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

For example,

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




Parameters:

array   $value   abbreviated day names.

[ Top ]

method setAbbreviatedMonthNames [line 305]

void setAbbreviatedMonthNames( array $value)

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

For example,

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




Parameters:

array   $value   month names.

[ Top ]

method setAMDesignator [line 362]

void setAMDesignator( string $value)

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



Parameters:

string   $value   AM designator.

[ Top ]

method setAMPMMarkers [line 406]

void setAMPMMarkers( array $value)

Set the AM and PM markers array.

For example

  1. array('AM','PM');




Parameters:

array   $value   AM and PM markers

[ Top ]

method setDayNames [line 256]

void setDayNames( array $value)

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

For example,

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




Parameters:

array   $value   day names.

[ Top ]

method setMonthNames [line 331]

void setMonthNames( array $value)

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

For example,

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




Parameters:

array   $value   month names.

[ Top ]

method setNarrowDayNames [line 230]

void setNarrowDayNames( array $value)

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

For example,

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




Parameters:

array   $value   narrow day names.

[ Top ]

method setNarrowMonthNames [line 280]

void setNarrowMonthNames( array $value)

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

For example,

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




Parameters:

array   $value   month names.

[ Top ]

method setPMDesignator [line 384]

void setPMDesignator( string $value)

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



Parameters:

string   $value   PM designator.

[ Top ]

method __get [line 97]

mixed __get( mixed $name)

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



[ Top ]

method __set [line 110]

void __set( mixed $name, mixed $value)

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



[ Top ]


© 2004-2005 PRADO Software Group. All Rights Reserved.