Date and Time formats
Date and Time formats
I'm new to this and wondering if anyone can point me in the right direction around date formats. I'm a registered user of the editor - the combination of the editor and grid has been an amazing experience
The set up involves
* A standard MySQL
* A generator instance against a simple booking table
On the automatically generated js file, there is a formatting option for date time fields
{
"label": "Departure date \/ time:",
"name": "departureDateTime",
"type": "datetime",
"format": "ddd D MMM gggg h:mm A" <-- Does this fomat the field / the widget?
},
On the PHP Side
Field::inst('departurePickupTime')
->validator(Validate::dateFormat('H:i A'))
->getFormatter(Format::datetime('H:i:s', 'H:iA'))
->setFormatter(Format::datetime('H:i A', 'H:i:s')),
The goal is to get a Mon 14 Jul 2018 08:12pm format on the grid and in the form thing
Can anyone please point me at information on the roles of the
- JS Validation
- The get and set formatters
- PHP Validation
Have already read the docs several times over
Thanks for any tips :-)
This question has an accepted answers - jump to answer
Answers
The idea here is that the client-side should see only one format (and submit that same format). So the get and set formatters are used to convert it:
would be what you want on the server-side. e.g. on "get" convert from ISO8601 to
D j M Y h:iA
(see the PHP docs for that). Then the reverse for the set formatter and use the appropriate validator.Allan
Excellent - thanks very much. Really appreciate the response