Reputation: 2586
i would to know how can i parse date and time which we choose from date time picker into standard date('YmdHis')
type of results?
$datetime = date('YmdHis);
eg date picker return result 11/13/2012
and time picker result is 2.30 AM
, now i need to know how to joining them together and convert it to 20121113023000
format?
Upvotes: 0
Views: 388
Reputation: 9457
echo date("YmdHis",strtotime('11/13/2012 2.30 AM'));
or
$data = $_POST['date_picker']." ".$_POST['time_picker'];
echo date("YmdHis",strtotime($data));
this will output that in required format
outputs
20121113023000
Upvotes: 1
Reputation: 10070
echo date("Y-m-d H:i:s",strtotime("11/13/2012 2.30 AM"));
outputs
2012-11-13 02:30:00
Upvotes: 1
Reputation: 18006
This should work
$datatime = date('YmdHis',strtotime($_POST['datepickerfield']));
Upvotes: 1