Chronos FormattingTrait

Well found this in the docs


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:

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:

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?