How to get the local date formated like this: 2002-03-15 Y2K Problem
| From: | Andy | Date: | Tue, 05 Mar 2002 07:59:19 +0000 |
| Subject: | How to get the local date formated like this: 2002-03-15 Y2K Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87236@lists.php.net to get a copy of this message | ||
Hi there,
I am trying to find out how to get the local date in a format conform to
this: 2002-03-15.
The following code is a try, but it does not work like I want:
$local_time = localtime(time() , 1);
echo "Date: " .
$local_time[tm_year].'-'.$local_time[tm_mon].'-'.$local_time[tm_mday];
Returns: Date: 102-2-5
The prob is, that tm_year is not y2k compliant and the 0 are missing for
month and day
The goal is to find out, if a date provided by the user is in the future or
not. His date is in this format: [yyyy-mm-dd]
Has anybody an idea?
Thanx,
Andy