PHP time format, am and pm with periods

前端 未结 4 1417
粉色の甜心
粉色の甜心 2021-01-07 08:15

How could I adjust the php time format to a.m and p.m with the periods included?

date(\'h:i a\');
4条回答
  •  死守一世寂寞
    2021-01-07 08:47

    There's no straightforward way.

    What I'd do is fetch date("a"), see whether it's am or pm, and then output a.m or p.m accordingly.

提交回复
热议问题