This topic is locked
[SOLVED]

 Formatting date field

12/20/2017 8:50:29 AM
PHPRunner General questions
M
mrl40 author

Hi

I have a date field in my mysql database called "Date Booked" and it's appearing on form as short date e.g. 12/05/17 I would like it to show Mon/12/May/17 on the form.
Thanks for any help

Admin 12/20/2017

Check PHP date() function:

http://php.net/manual/en/function.date.php
It comes with a number of examples. If you use 'View as' Custom you will also need to use strtotime() function to convert date value to timestamp first.

$value = date('l dS \o\f F Y h:i:s A', strtotime($value) );
M
mrl40 author 12/21/2017



Check PHP date() function:

http://php.net/manual/en/function.date.php
It comes with a number of examples. If you use 'View as' Custom you will also need to use strtotime() function to convert date value to timestamp first.

$value = date('l dS \o\f F Y h:i:s A', strtotime($value) );



Thanks

That advice was great, the format I used was

$value = date('D/d/M/Y', strtotime($value) );