class DateFormat extends Format (View source)

Constants

TYPE

Properties

string $formatType A quick formatting option for the date.
string $pattern Format string, as a subset of the ICU pattern set.
string $timeZone timeZone to assign to values in the visualization.

Methods

mixed
__construct( array $config = array())

Builds the NumberFormat object with specified options

array
getValues()

Same as toArray, but without the class name as a key to being multi-dimension.

from  Format
string
toJson()

Returns a JSON string representation of the object's properties.

from  Format
formatType( string $ft)

Sets a quick formatting option for the date.

pattern( string $p)

A custom format pattern to apply to the value, similar to the ICU date and time format.

timeZone( string $tz)

Sets the time zone in which to display the date value.

Details

at line 57
mixed __construct( array $config = array())

Builds the NumberFormat object with specified options

Parameters

array $config Array of options.

Return Value

mixed

Exceptions

InvalidConfigValue
InvalidConfigProperty

in Format at line 79
array getValues()

Same as toArray, but without the class name as a key to being multi-dimension.

Return Value

array Array of the options of the object.

in Format at line 97
string toJson()

Returns a JSON string representation of the object's properties.

Return Value

string

at line 78
DateFormat formatType( string $ft)

Sets a quick formatting option for the date.

The following string values are supported, reformatting the date February 28, 2008 as shown:

'short' - Short format: e.g., "2/28/08" 'medium' - Medium format: e.g., "Feb 28, 2008" 'long' - Long format: e.g., "February 28, 2008"

You cannot specify both formatType and pattern.

Parameters

string $ft

Return Value

DateFormat

Exceptions

InvalidConfigValue

at line 109
DateFormat pattern( string $p)

A custom format pattern to apply to the value, similar to the ICU date and time format.

For example: new DateFormat({pattern: "EEE, MMM d, ''yy"});

You cannot specify both formatType and pattern.

Parameters

string $p

Return Value

DateFormat

Exceptions

InvalidConfigValue

See also

http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Field-Symbol-Table

at line 139
DateFormat timeZone( string $tz)

Sets the time zone in which to display the date value.

This is a numeric value, indicating GMT + this number of time zones (can be negative). Date object are created by default with the assumed time zone of the computer on which they are created; this option is used to display that value in a different time zone.

For example, if you created a Date object of 5pm noon on a computer located in Greenwich, England, and specified timeZone to be -5 (options['timeZone'] = -5, or Eastern Pacific Time in the US), the value displayed would be 12 noon.

Parameters

string $tz

Return Value

DateFormat

Exceptions

InvalidConfigValue