Set time in php to 00:00:00

后端 未结 4 713
名媛妹妹
名媛妹妹 2021-02-08 10:40

I need to display the time but it must start from 00:00:00? I\'ve got the following but it uses the current time.

print(date(\"H:i:s\"));
4条回答
  •  说谎
    说谎 (楼主)
    2021-02-08 11:33

    date() uses the current time when you don't pass in an explicit timestamp. See the optional argument in the date documentation.

    If you want to explicitly format midnight, use:

    date("H:i:s", mktime(0, 0, 0));
    

提交回复
热议问题