How to change the format of input type datetime-local?

Maniraj Murugan picture Maniraj Murugan · Aug 7, 2017 · Viewed 8.7k times · Source

I am giving an input field with type datetime-local,

<input type="datetime-local" class="form-control" name="booking_checkin">

In which after filling and viewing it, the format is like this,

2017-08-06T02:32 .

It looks like awkward and i need this pattern to be changed,

I would like to have format like this,

2017-08-06, 02:32.

I apologise for not posting what i have tried because i don't even have a start up idea to get it after searching a lot here.. Kindly help me to solve it..

Answer

perumal N picture perumal N · Aug 7, 2017

Change date format on server-side

    <?php 
$date = date('Y-m-d, h:i',strtotime($_POST['booking_checkin']));
?>