How do I create a variable in PHP of today's date of MM/DD/YYYY format?

后端 未结 6 1364
天涯浪人
天涯浪人 2021-01-02 10:56

How do I create a variable in PHP of today\'s date of MM/DD/YYYY format?

I need to input that date as a hidden form field when someone comes onto the site. So I wo

6条回答
  •  青春惊慌失措
    2021-01-02 11:23

    use the builtin date() function.

    $myDate = date('m/d/Y');
    

    the string parameter 'm/d/Y' is the returned date pattern. m is for 2 digit months, d for 2 digit day value and Y for 4 digit year value.

提交回复
热议问题