# Chronos FormattingTrait

**URL:** <https://discourse.cakephp.org/t/chronos-formattingtrait/1239>\
**Category:** Uncategorized\
**Created:** [September 24, 2016, 5:35pm UTC](https://discourse.cakephp.org/t/chronos-formattingtrait/1239 "2016-09-24T17:35:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jimgwhit](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/jimgwhit/32/378_2.png) [@jimgwhit](https://discourse.cakephp.org/u/jimgwhit)\
**Post date:** [September 24, 2016, 6:06pm UTC](https://discourse.cakephp.org/t/chronos-formattingtrait/1239/2 "2016-09-24T18:06:42Z")

</div>

Well found this in the docs

```auto

Formatting Strings

Chronos provides a number of methods for displaying our outputting datetime objects:

// Uses the format controlled by setToStringFormat()
echo $date;

// Different standard formats
echo $time->toAtomString(); // 1975-12-25T14:15:16-05:00
echo $time->toCookieString(); // Thursday, 25-Dec-1975 14:15:16 EST
echo $time->toIso8601String(); // 1975-12-25T14:15:16-05:00
echo $time->toRfc822String(); // Thu, 25 Dec 75 14:15:16 -0500
echo $time->toRfc850String(); // Thursday, 25-Dec-75 14:15:16 EST
echo $time->toRfc1036String(); // Thu, 25 Dec 75 14:15:16 -0500
echo $time->toRfc1123String(); // Thu, 25 Dec 1975 14:15:16 -0500
echo $time->toRfc2822String(); // Thu, 25 Dec 1975 14:15:16 -0500
echo $time->toRfc3339String(); // 1975-12-25T14:15:16-05:00
echo $time->toRssString(); // Thu, 25 Dec 1975 14:15:16 -0500
echo $time->toW3cString(); // 1975-12-25T14:15:16-05:00

// Get the quarter
echo $time->toQuarter(); // 4;

```

Apparently a genius decided to leave out this example:

```auto
toDateTimeString()

```

If toDateTimeString() is in the docs anywhere it is well hidden, those docs leave much to be desired.  
Also I notice no “use” statement is needed, this seems to work fine:

```auto
echo "<td style=\"width:40px;\">" . $row->lastedit->toDateTimeString() . "</td>";

```

The docs could stand to have better examples for folks new to cakephp. If I had not come from laravel which uses traits, I would have never figured this out. How is a newcomer? Also what is that I18n stuff, I got it formatted with no I18n. So this is also very confusing, the I18n topic.

Wouldn’t cakephp be better off just using php built in date time stuff?

---

_[View the full topic](https://discourse.cakephp.org/t/chronos-formattingtrait/1239)._
