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

后端 未结 6 1349
天涯浪人
天涯浪人 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:08

    What about using the function date ? Just have to find the right format ; 'm' for month, 'd' for day, 'Y' for year using four digits, for instance

    In your case, something like this, I guess :

    date("m/d/Y")
    

    And if you want another day than now, use the second optional parameter.

提交回复
热议问题