DateFormatter

Type
Class
Namespace
Craft
Inherits
Craft\DateFormatter » CDateFormatter (opens new window) » CComponent (opens new window)
Since
1.0

DateFormatter class with functions for date/time-pickers.

See also http://craftcms.com

View source (opens new window)

# Protected Properties

Property Description
$_locale (opens new window)

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__construct() (opens new window) Constructor.
__get() (opens new window) Returns a property value, an event handler list or a behavior based on its name.
__isset() (opens new window) Checks if a property value is null.
__set() (opens new window) Sets value of a component property.
__unset() (opens new window) Sets a component property to be null.
asa() (opens new window) Returns the named behavior object.
attachBehavior() (opens new window) Attaches a behavior to this component.
attachBehaviors() (opens new window) Attaches a list of behaviors to the component.
attachEventHandler() (opens new window) Attaches an event handler to an event.
canGetProperty() (opens new window) Determines whether a property can be read.
canSetProperty() (opens new window) Determines whether a property can be set.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
detachEventHandler() (opens new window) Detaches an existing event handler.
disableBehavior() (opens new window) Disables an attached behavior.
disableBehaviors() (opens new window) Disables all behaviors attached to this component.
enableBehavior() (opens new window) Enables an attached behavior.
enableBehaviors() (opens new window) Enables all behaviors attached to this component.
evaluateExpression() (opens new window) Evaluates a PHP expression or callback under the context of this component.
format() (opens new window) Formats a date according to a customized pattern.
formatDateTime() Add support for DateTime objects.
getDatepickerJsFormat() Returns the jQuery UI Datepicker date format.
getDatepickerPhpFormat() Returns the PHP date format for datepickers.
getEventHandlers() (opens new window) Returns the list of attached event handlers for an event.
getTimepickerPhpFormat() Returns the PHP time format for timepickers.
hasEvent() (opens new window) Determines whether an event is defined.
hasEventHandler() (opens new window) Checks whether the named event has attached handlers.
hasProperty() (opens new window) Determines whether a property is defined.
raiseEvent() (opens new window) Raises an event.

# formatDateTime()

Add support for DateTime objects.

View source (opens new window)

Arguments

Returns

string (opens new window)

Signature

public string formatDateTime ( $timestamp, $dateWidth = 'medium', $timeWidth = 'medium' )

# getDatepickerJsFormat()

Returns the jQuery UI Datepicker date format.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getDatepickerJsFormat ( )

# getDatepickerPhpFormat()

Returns the PHP date format for datepickers.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getDatepickerPhpFormat ( )

# getTimepickerPhpFormat()

Returns the PHP time format for timepickers.

View source (opens new window)

Returns

string (opens new window)

Signature

public string getTimepickerPhpFormat ( )

# Protected Methods

Method Description
formatDay() (opens new window) Get the day of the month.
formatDayInMonth() (opens new window) Get day of week in the month, e.g. 2nd Wed in July.
formatDayInWeek() (opens new window) Get the day of the week.
formatDayInYear() (opens new window) Get the day in the year, e.g. [1-366]
formatEra() (opens new window) Get the era. i.e. in gregorian, year > 0 is AD, else BC.
formatHour12() (opens new window) Get the hours in 12 hour format, i.e., [1-12] "h" for non-padding, "hh" will always return 2 characters.
formatHour24() (opens new window) Get the hours in 24 hour format, i.e. [0-23].
formatHourInDay() (opens new window) Get the hours [1-24].
formatHourInPeriod() (opens new window) Get the hours in AM/PM format, e.g [0-11] "K" for non-padding, "KK" will always return 2 characters.
formatMinutes() (opens new window) Get the minutes.
formatMonth() (opens new window) Get the month.
formatPeriod() (opens new window) Get the AM/PM designator, 12 noon is PM, 12 midnight is AM.
formatSeconds() (opens new window) Get the seconds.
formatTimeZone() (opens new window) Get the timezone of the server machine.
formatWeekInMonth() (opens new window) Get week in the month.
formatWeekInYear() (opens new window) Get the week in the year.
formatYear() (opens new window) Get the year.
parseFormat() (opens new window) Parses the datetime format pattern.