Don't understand page->date('c') in template note.php of starterkit - could someone help?

Good morning,

I get stuck with this line
<time class="note-date" datetime="<?= $page->date('c') ?>">Published on <?= $page->date() ?></time>
in the note.php template of the starterkit.
Where does the β€˜c’ in $page->date(β€˜c’) come from? Is this the β€œc” format explained at https://www.php.net/manual/en/datetime.format.php ?
How would I change the output to β€˜j. F Y, H:i’?

Thanks in advance for any help!

All the best,
Stephan

Yes. But see valid formats for the time tags datetime attribute: <time>: The (Date) Time element - HTML: HyperText Markup Language | MDN

By providing this format as attribute instead of c.

Note that usually you would output a date field like this:

$page->date()->toDate('c')

The reason the toDate() field method is missing in the example is a custom date method in the NotePage model.

1 Like

Thanks a million for the detailed explanation!

Very much appreciated.

All the best,
Stephan