String date current date/time?

后端 未结 6 1529
北恋
北恋 2021-02-19 00:51

I am using $date = date(\"D M d, Y G:i\");.

When I echo $date, it shows the correct date/time. Now I need this as an string.

I have tr

6条回答
  •  名媛妹妹
    2021-02-19 01:05

    If you like working with objects you can do this:

    $date = new \DateTime('now');
    echo $date->format('D M d, Y G:i');
    

提交回复
热议问题