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 1.x API

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

Namespaces

  • Global
  • Cake\Chronos

Class DifferenceFormatter

Handles formatting differences in text.

Provides a swappable component for other libraries to leverage. when localizing or customizing the difference output.

Namespace: Cake\Chronos

Property Summary

  • $translate protected
    Cake\Chronos\Translator

    The text translator object

Method Summary

  • __construct() public

    Constructor.

  • diffForHumans() public

    Get the difference in a human readable format.

Method Detail

__construct() ¶ public

__construct(Cake\Chronos\Translator|null $translate = null)

Constructor.

Parameters
Cake\Chronos\Translator|null $translate optional

The text translator object.

diffForHumans() ¶ public

diffForHumans(Cake\Chronos\ChronosInterface $date, Cake\Chronos\ChronosInterface|null $other = null, bool $absolute = false): string

Get the difference in a human readable format.

Parameters
Cake\Chronos\ChronosInterface $date

The datetime to start with.

Cake\Chronos\ChronosInterface|null $other optional

The datetime to compare against.

bool $absolute optional

removes time difference modifiers ago, after, etc

Returns
string
See Also
\Cake\Chronos\ChronosInterface::diffForHumans

Property Detail

$translate ¶ protected

The text translator object

Type
Cake\Chronos\Translator
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