\Cake\Chronos\TraitsFormattingTrait

Provides string formatting methods for datetime instances.

Expects implementing classes to define static::$toStringFormat

Summary

Methods
Properties
Constants
resetToStringFormat()
setToStringFormat()
__toString()
toDateString()
toFormattedDateString()
toTimeString()
toDateTimeString()
toDayDateTimeString()
toAtomString()
toCookieString()
toIso8601String()
toRfc822String()
toRfc850String()
toRfc1036String()
toRfc1123String()
toRfc2822String()
toRfc3339String()
toRssString()
toW3cString()
toUnixString()
toQuarter()
toWeek()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

resetToStringFormat()

resetToStringFormat() : void

Reset the format used to the default when type juggling a ChronosInterface instance to a string

setToStringFormat()

setToStringFormat(string  $format) : void

Set the default format used when type juggling a ChronosInterface instance to a string

Parameters

string $format

The format to use in future __toString() calls.

__toString()

__toString() : string

Format the instance as a string using the set format

Returns

string

toDateString()

toDateString() : string

Format the instance as date

Returns

string

toFormattedDateString()

toFormattedDateString() : string

Format the instance as a readable date

Returns

string

toTimeString()

toTimeString() : string

Format the instance as time

Returns

string

toDateTimeString()

toDateTimeString() : string

Format the instance as date and time

Returns

string

toDayDateTimeString()

toDayDateTimeString() : string

Format the instance with day, date and time

Returns

string

toAtomString()

toAtomString() : string

Format the instance as ATOM

Returns

string

toCookieString()

toCookieString() : string

Format the instance as COOKIE

Returns

string

toIso8601String()

toIso8601String() : string

Format the instance as ISO8601

Returns

string

toRfc822String()

toRfc822String() : string

Format the instance as RFC822

Returns

string

toRfc850String()

toRfc850String() : string

Format the instance as RFC850

Returns

string

toRfc1036String()

toRfc1036String() : string

Format the instance as RFC1036

Returns

string

toRfc1123String()

toRfc1123String() : string

Format the instance as RFC1123

Returns

string

toRfc2822String()

toRfc2822String() : string

Format the instance as RFC2822

Returns

string

toRfc3339String()

toRfc3339String() : string

Format the instance as RFC3339

Returns

string

toRssString()

toRssString() : string

Format the instance as RSS

Returns

string

toW3cString()

toW3cString() : string

Format the instance as W3C

Returns

string

toUnixString()

toUnixString() : string

Returns a UNIX timestamp.

Returns

string —

UNIX timestamp

toQuarter()

toQuarter(boolean  $range = false) : integer|array

Returns the quarter

Parameters

boolean $range

Range.

Returns

integer|array —

1, 2, 3, or 4 quarter of year or array if $range true

toWeek()

toWeek() : integer

Returns

integer