class DateFormat extends Format (View source)

Constants

TYPE

Type of format object

Methods

__construct( array $config = array())

Builds the DateFormat object with specified options

mixed
__get( string $option)

Get the value of a set option via magic method.

from  JsonConfig
getOptions()

Gets the Options object for the JsonConfig

from  JsonConfig
setOption( string $option, mixed $value)

Shortcut method to set the value of an option and return $this.

from  JsonConfig
setOptions( array $config)

Parses the config array by passing the values through each method to check validity against if the option exists.

from  JsonConfig
array
jsonSerialize()

Custom serialization of the JsonConfig object.

from  JsonConfig
string
getType()

Returns the format type.

from  Format
formatType( string $formatType)

Sets a quick formatting option for the date.

pattern( string $pattern)

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

timeZone( string $timeZone)

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

Details

at line 51
__construct( array $config = array())

Builds the DateFormat object with specified options

Parameters

array $config

Exceptions

InvalidConfigValue
InvalidConfigProperty

in JsonConfig at line 64
mixed __get( string $option)

Get the value of a set option via magic method.

Parameters

string $option Name of option.

Return Value

mixed

Exceptions

InvalidConfigProperty

in JsonConfig at line 75
Options getOptions()

Gets the Options object for the JsonConfig

Return Value

Options

in JsonConfig at line 90
JsonConfig setOption( string $option, mixed $value)

Shortcut method to set the value of an option and return $this.

In order to maintain backwards compatibility, ConfigObjects will be unwrapped.

Parameters

string $option Option to set.
mixed $value Value of the option.

Return Value

JsonConfig

in JsonConfig at line 106
setOptions( array $config)

Parses the config array by passing the values through each method to check validity against if the option exists.

Parameters

array $config

Exceptions

InvalidConfigValue
InvalidConfigProperty

in JsonConfig at line 275
array jsonSerialize()

Custom serialization of the JsonConfig object.

Return Value

array

in Format at line 46
string getType()

Returns the format type.

Return Value

string

at line 71
DateFormat formatType( string $formatType)

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 $formatType

Return Value

DateFormat

Exceptions

InvalidConfigValue

at line 94
DateFormat pattern( string $pattern)

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

For example: "EEE, MMM d, 'yy" Also, you cannot specify both formatType and pattern.

Parameters

string $pattern

Return Value

DateFormat

Exceptions

InvalidConfigValue

See also

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

at line 115
DateFormat timeZone( string $timeZone)

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 $timeZone

Return Value

DateFormat

Exceptions

InvalidConfigValue