Date variable

Hi everyone,
I’d like to create a variable : “$myDate” of date type with a value attached: “2001-01-31” which is 31th January 2001.
Problem is, I dont know how to do it :frowning:
Can anyone, please, show me how to assign a date to a date variable in PHP?

Since you want an extract date you can just hardcore it

[php]
$myDate = ‘2001-01-31’;
[/php]

For dynamic dates you can use the date function

[php]
$today = date(‘Y-m-d’);
[/php]

Hi,

Eventually, this can help too, should you wish to try other formats, just scroll down to ,Example #4 date() Formatting,:
http://php.net/manual/en/function.date.php

Thanks a lot Dave

Thanks a lot Clusteer_one

Sponsor our Newsletter | Privacy Policy | Terms of Service