PHP Trait Cake\Chronos\Traits\FormattingTrait

Expects implementing classes to define static::$toStringFormat
Show file Open project: cakephp/chronos

Public Methods

Method Description
__toString ( ) : string Format the instance as a string using the set format
resetToStringFormat ( ) : void Reset the format used to the default when type juggling a ChronosInterface instance to a string
setToStringFormat ( string $format ) : void Set the default format used when type juggling a ChronosInterface instance to a string
toAtomString ( ) : string Format the instance as ATOM
toCookieString ( ) : string Format the instance as COOKIE
toDateString ( ) : string Format the instance as date
toDateTimeString ( ) : string Format the instance as date and time
toDayDateTimeString ( ) : string Format the instance with day, date and time
toFormattedDateString ( ) : string Format the instance as a readable date
toIso8601String ( ) : string Format the instance as ISO8601
toQuarter ( boolean $range = false ) : mixed Returns the quarter
toRfc1036String ( ) : string Format the instance as RFC1036
toRfc1123String ( ) : string Format the instance as RFC1123
toRfc2822String ( ) : string Format the instance as RFC2822
toRfc3339String ( ) : string Format the instance as RFC3339
toRfc822String ( ) : string Format the instance as RFC822
toRfc850String ( ) : string Format the instance as RFC850
toRssString ( ) : string Format the instance as RSS
toTimeString ( ) : string Format the instance as time
toUnixString ( ) : string Returns a UNIX timestamp.
toW3cString ( ) : string Format the instance as W3C
toWeek ( ) : integer

Method Details

__toString() public method

Format the instance as a string using the set format
public __toString ( ) : string
return string

resetToStringFormat() public static method

Reset the format used to the default when type juggling a ChronosInterface instance to a string
public static resetToStringFormat ( ) : void
return void

setToStringFormat() public static method

Set the default format used when type juggling a ChronosInterface instance to a string
public static setToStringFormat ( string $format ) : void
$format string The format to use in future __toString() calls.
return void

toAtomString() public method

Format the instance as ATOM
public toAtomString ( ) : string
return string

toCookieString() public method

Format the instance as COOKIE
public toCookieString ( ) : string
return string

toDateString() public method

Format the instance as date
public toDateString ( ) : string
return string

toDateTimeString() public method

Format the instance as date and time
public toDateTimeString ( ) : string
return string

toDayDateTimeString() public method

Format the instance with day, date and time
public toDayDateTimeString ( ) : string
return string

toFormattedDateString() public method

Format the instance as a readable date
public toFormattedDateString ( ) : string
return string

toIso8601String() public method

Format the instance as ISO8601
public toIso8601String ( ) : string
return string

toQuarter() public method

Returns the quarter
public toQuarter ( boolean $range = false ) : mixed
$range boolean Range.
return mixed 1, 2, 3, or 4 quarter of year or array if $range true

toRfc1036String() public method

Format the instance as RFC1036
public toRfc1036String ( ) : string
return string

toRfc1123String() public method

Format the instance as RFC1123
public toRfc1123String ( ) : string
return string

toRfc2822String() public method

Format the instance as RFC2822
public toRfc2822String ( ) : string
return string

toRfc3339String() public method

Format the instance as RFC3339
public toRfc3339String ( ) : string
return string

toRfc822String() public method

Format the instance as RFC822
public toRfc822String ( ) : string
return string

toRfc850String() public method

Format the instance as RFC850
public toRfc850String ( ) : string
return string

toRssString() public method

Format the instance as RSS
public toRssString ( ) : string
return string

toTimeString() public method

Format the instance as time
public toTimeString ( ) : string
return string

toUnixString() public method

Returns a UNIX timestamp.
public toUnixString ( ) : string
return string UNIX timestamp

toW3cString() public method

Format the instance as W3C
public toW3cString ( ) : string
return string

toWeek() public method

public toWeek ( ) : integer
return integer