开发者

converting date format from 0000-00-00 to timestamp

I have a date picker that returns date in the format 0000-00-00 with

$startT = isset($_POST["startT"]) ? $_POST["startT"] : "";
开发者_如何学运维

how do I convert this formatted date into a timestamp? Thanks


If you have PHP 5.3, which you should, the easiest way is:

$timestamp = new DateTime($_POST['startT']);
$timestamp->getTimestamp();


The easiest way is

echo mktime($_POST["startT"]);


Use strtotime() which works pretty fine in most cases

$time = strtotime($_POST['startT']);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜