开发者

How do I convert a date in PHP?

开发者 https://www.devze.com 2022-12-15 02:10 出处:网络
How can I convert this date: 2009-12-21 10:38开发者_如何转开发:07 to a more readable date, like 22 December 2009 - 10:38

How can I convert this date:

2009-12-21 10:38开发者_如何转开发:07

to a more readable date, like 22 December 2009 - 10:38 ?


You can use the date function with strtotime:

$strDate = "2009-12-21 10:38:07";
echo date('d F Y - H:i', strtotime($strDate));


// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
0

精彩评论

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