DateFormatter

Type
Class
Namespace
Craft
Inherits
Craft\DateFormatter » CDateFormatter » CComponent
Since
1.0

DateFormatter class with functions for date/time-pickers.

See also http://craftcms.com

View source

Protected Properties

PropertyDescription
$_locale

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__construct()Constructor.
__get()Returns a property value, an event handler list or a behavior based on its name.
__isset()Checks if a property value is null.
__set()Sets value of a component property.
__unset()Sets a component property to be null.
asa()Returns the named behavior object.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
attachEventHandler()Attaches an event handler to an event.
canGetProperty()Determines whether a property can be read.
canSetProperty()Determines whether a property can be set.
detachBehavior()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
detachEventHandler()Detaches an existing event handler.
disableBehavior()Disables an attached behavior.
disableBehaviors()Disables all behaviors attached to this component.
enableBehavior()Enables an attached behavior.
enableBehaviors()Enables all behaviors attached to this component.
evaluateExpression()Evaluates a PHP expression or callback under the context of this component.
format()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()Returns the list of attached event handlers for an event.
getTimepickerPhpFormat()Returns the PHP time format for timepickers.
hasEvent()Determines whether an event is defined.
hasEventHandler()Checks whether the named event has attached handlers.
hasProperty()Determines whether a property is defined.
raiseEvent()Raises an event.

formatDateTime()

Add support for DateTime objects.

View source

Arguments

Returns

string

Signature

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

getDatepickerJsFormat()

Returns the jQuery UI Datepicker date format.

View source

Returns

string

Signature

public string getDatepickerJsFormat ( )

getDatepickerPhpFormat()

Returns the PHP date format for datepickers.

View source

Returns

string

Signature

public string getDatepickerPhpFormat ( )

getTimepickerPhpFormat()

Returns the PHP time format for timepickers.

View source

Returns

string

Signature

public string getTimepickerPhpFormat ( )

Protected Methods

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