NOW() function in PHP

前端 未结 20 1725
遥遥无期
遥遥无期 2020-11-28 17:26

Is there a PHP function that returns the date and time in the same format as the MySQL function NOW()?

I know how to do it using date(), b

20条回答
  •  忘掉有多难
    2020-11-28 17:49

    Use strftime:

    strftime("%F %T");
    
    • %F is the same as %Y-%m-%d.

    • %T is the same as %H:%M:%S.

    Here's a demo on ideone.

提交回复
热议问题