如何在php日期函数中打印“at”?

时间:2013-05-20 10:52:43

标签: php

我尝试使用date("F j, Y \a\t h:i a", strtotime($date));

但这会产生May 20, 2013 a 04:37 pm

我还尝试了date("F j, Y \at\ h:i a", strtotime($date));

date("F j, Y \a\t\ h:i a", strtotime($date));

它变成了May 20, 2013 a31 04:37 pm

我想要制作的是May 20, 2013 at 04:37 pm

谢谢!

1 个答案:

答案 0 :(得分:5)

双引号\t将被解释为制表符。使用单引号(或双斜线)可以解决问题:

echo date('F j, Y \a\t h:i a', strtotime('2013-05-20 23:59:59'));
// output: May 20, 2013 at 11:59 pm