Date format

I use a date format of YYYY-MM-DD. Is there an easy way to accomplish this currently? If not, I’ll add a configuration option to set the date format.

Where are you looking to use this date format? in the filename? for the date of the page?

Under admin - options - publishing, the date is currently ‘01-09-2014 14:55’. This translates to the the page.md yaml file having a line of 'date: ‘01-09-2014 14:55’.

Forward slash (/) signifies American M/D/Y formatting, a dash (-) signifies European D-M-Y and a period (.) signifies ISO Y.M.D.

So you can use YYYY.MM.DD for date:, but if you save it directly in expert mode. The admin is storing dates in the european format. Currently that is not configurable, but probably could be a configuration option.

Please submit an admin issue about it: https://github.com/getgrav/grav-plugin-admin/issues

I set “date: ‘2015.09.01 14:55’” in the yaml page.md file, but the site shows “02 Sep”. Is it getting the date off of the file ctime?

An exception has been thrown during the rendering of a template (“DateTime::__construct(): Failed to parse time string (2015.09.01 14:55) at position 5 (0): Double time specification”) in “forms/fields/datetime/datetime.html.twig” at line 4.

Hmm… i’ll have to test this… to be honest i’ve only ever used US or Euro style, never this ISO Y.M.D style date.

Can you create an issue for me so i don’t lose track of this one? I’m in the middle of a few other issues at the moment. cheers!

Sure, thanks. :slight_smile:

Hm, I have tried to set the “Published date” of blog posts in the admin area. Regardless of whether I use US or Euro style, the system always throws the same error as soon as I try to save the settings. It reads, “0 - An exception has been thrown during the rendering of a template (“DateTime::__construct(): Failed to parse time string (16, 2016) at position 0 (1): Unexpected character”) in “forms/fields/datetime/datetime.html.twig” at line 7.”
But for the life of me, I cannot see which “unexpected character” the system might refer to. At any rate, the published time will always be set to the day one creates the page.