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?
这应该工作
$datatime = date('YmdHis',strtotime($_POST['datepickerfield']));
echo date("Y-m-d H:i:s",strtotime("11/13/2012 2.30 AM"));
输出
2012-11-13 02:30:00
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.