Format date from database?

后端 未结 5 1639
半阙折子戏
半阙折子戏 2020-12-01 05:45

When I pull the date out of the db, it comes back like this:

2009-10-14T19:00:00

I want to format it in two different ways...

The first: F d, Y The s

5条回答
  •  执笔经年
    2020-12-01 06:11

    Normally the code is just:

    echo date('F d, Y h:mA', strtotime('2009-10-14 19:00:00'));
    

    Note that if strtotime() can't figure out the date, it returns the time as 1/1/1970 00:00:00 GMT.

提交回复
热议问题