RE: [PHP] How to get the local date formated like this: 2002-03-15 Y2K Problem

From: Date: Tue, 05 Mar 2002 08:24:58 +0000
Subject: RE: [PHP] How to get the local date formated like this: 2002-03-15 Y2K Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-87237@lists.php.net to get a copy of this message
date("Y-m-d"); Niklas -----Original Message----- From: Andy [mailto:news.letters@gmx.de] Sent: 5. maaliskuuta 2002 9:59 To: php-general@lists.php.net Subject: [PHP] How to get the local date formated like this: 2002-03-15 Y2K Problem 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#87237) next »