CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C Chronos 3.x API

  • Project:
    • Chronos
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.x
      • 3.x
      • 2.x
      • 1.x

Namespaces

  • Cake\Chronos

Trait FormattingTrait

Provides string formatting methods for datetime instances.

Expects implementing classes to define static::$toStringFormat

Namespace: Cake\Chronos

Method Summary

  • __toString() public

    Returns a formatted string specified by setToStringFormat() or the default DEFAULT_TO_STRING_FORMAT format.

  • resetToStringFormat() public static

    Resets the __toString() format to DEFAULT_TO_STRING_FORMAT.

  • setToStringFormat() public static

    Sets the __toString() format.

  • toAtomString() public

    Format the instance as ATOM

  • toCookieString() public

    Format the instance as COOKIE

  • toDateString() public

    Format the instance as date

  • toDateTimeString() public

    Format the instance as date and time

  • toDayDateTimeString() public

    Format the instance with day, date and time

  • toFormattedDateString() public

    Format the instance as a readable date

  • toIso8601String() public

    Format the instance as ISO8601

  • toQuarter() public

    Returns the quarter

  • toRfc1036String() public

    Format the instance as RFC1036

  • toRfc1123String() public

    Format the instance as RFC1123

  • toRfc2822String() public

    Format the instance as RFC2822

  • toRfc3339String() public

    Format the instance as RFC3339

  • toRfc822String() public

    Format the instance as RFC822

  • toRfc850String() public

    Format the instance as RFC850

  • toRssString() public

    Format the instance as RSS

  • toTimeString() public

    Format the instance as time

  • toUnixString() public

    Returns a UNIX timestamp.

  • toW3cString() public

    Format the instance as W3C

  • toWeek() public

    Returns ISO 8601 week number of year, weeks starting on Monday

Method Detail

__toString() ¶ public

__toString(): string

Returns a formatted string specified by setToStringFormat() or the default DEFAULT_TO_STRING_FORMAT format.

Returns
string

resetToStringFormat() ¶ public static

resetToStringFormat(): void

Resets the __toString() format to DEFAULT_TO_STRING_FORMAT.

Returns
void

setToStringFormat() ¶ public static

setToStringFormat(string $format): void

Sets the __toString() format.

Parameters
string $format

See format() for accepted specifiers.

Returns
void

toAtomString() ¶ public

toAtomString(): string

Format the instance as ATOM

Returns
string

toCookieString() ¶ public

toCookieString(): string

Format the instance as COOKIE

Returns
string

toDateString() ¶ public

toDateString(): string

Format the instance as date

Returns
string

toDateTimeString() ¶ public

toDateTimeString(): string

Format the instance as date and time

Returns
string

toDayDateTimeString() ¶ public

toDayDateTimeString(): string

Format the instance with day, date and time

Returns
string

toFormattedDateString() ¶ public

toFormattedDateString(): string

Format the instance as a readable date

Returns
string

toIso8601String() ¶ public

toIso8601String(): string

Format the instance as ISO8601

Returns
string

toQuarter() ¶ public

toQuarter(bool $range = false): array|int

Returns the quarter

Parameters
bool $range optional

Range.

Returns
array|int

toRfc1036String() ¶ public

toRfc1036String(): string

Format the instance as RFC1036

Returns
string
Links
https://tools.ietf.org/html/rfc1036

toRfc1123String() ¶ public

toRfc1123String(): string

Format the instance as RFC1123

Returns
string
Links
https://tools.ietf.org/html/rfc1123

toRfc2822String() ¶ public

toRfc2822String(): string

Format the instance as RFC2822

Returns
string
Links
https://tools.ietf.org/html/rfc2822

toRfc3339String() ¶ public

toRfc3339String(): string

Format the instance as RFC3339

Returns
string
Links
https://tools.ietf.org/html/rfc3339

toRfc822String() ¶ public

toRfc822String(): string

Format the instance as RFC822

Returns
string
Links
https://tools.ietf.org/html/rfc822

toRfc850String() ¶ public

toRfc850String(): string

Format the instance as RFC850

Returns
string
Links
https://tools.ietf.org/html/rfc850

toRssString() ¶ public

toRssString(): string

Format the instance as RSS

Returns
string

toTimeString() ¶ public

toTimeString(): string

Format the instance as time

Returns
string

toUnixString() ¶ public

toUnixString(): string

Returns a UNIX timestamp.

Returns
string

toW3cString() ¶ public

toW3cString(): string

Format the instance as W3C

Returns
string

toWeek() ¶ public

toWeek(): int

Returns ISO 8601 week number of year, weeks starting on Monday

Returns
int
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs