简体   繁体   中英

PHP, date(“DATE_COOKIE”) echoing odd result

Code:

echo ("<br><br>The date is: " . date("DATE_COOKIE"));

Result:

The date is: ThuPMUTCE_C+0000+0000K0E

Question:
Can anyone explain this odd result? Maybe I am using the date wrong. I looked at the referenced on W3 Schools .

As Sammitch said in a comment on my question, To avoid this odd result don't put quotes around constants.
In other words I had to remove the quotes from the DATE_COOKIE.

To get a better result, use new DateTime(DATE_COOKIE) or new DateTime(COOKIE) . That function return a datetime in a format like: Monday, 15-Aug-2005 15:52:01 UTC .

Here you can get more help The DateTime class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM