开发者

PHP simple date question

Function

echo date( "m/d/Y h:i a", "10/22/2009 12:32 am" );

Output

12/31/1969 07开发者_C百科:00 pm 

Why is my output not giving me the correct date, what am I doing wrong?


echo date( "m/d/Y h:i a", strtotime("10/22/2009 12:32 am" ));


The second argument should be a timestamp, not a date string.


How you can read in the PHP Documentation for the date function the second parameter must be an unix timestamp. You can use the mktime Function to convert your date into a timestamp.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜