开发者

How can I change PHP date format

开发者 https://www.devze.com 2023-01-16 12:46 出处:网络
A user selects dating like 22-Sep-2010 from jQuery datepicker. Is there a php function to 开发者_JAVA技巧convert that date to 22/09/2010?

A user selects dating like 22-Sep-2010 from jQuery datepicker.

Is there a php function to 开发者_JAVA技巧convert that date to 22/09/2010? Could strtottime or mktime be used?


$newTime = date('d/M/Y',strtotime($oldTime));

where $oldTime is the value from the date picker.


To convert the date format from dd-mmm-yyyy to dd/mm/yyyy in php,

<?php

$dt='22-Sep-2010';
$dt=date('d/m/Y',strtotime($dt));
echo $dt;

?>

The o/p will be, 22/09/2010

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号