Re: question regarding date format

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: question regarding date format
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-21784@lists.php.net to get a copy of this message
Smita, First off, if $date_test really contains "2002-8-02", then it contains a string and not a date. The date() function opperates off of a date. You need to convert the string to a date first with strtotime(). So make a small change to your code like this and see if that helps: echo date("F d, Y", strtotime($date_test)); Hope this helps. Jim -------Original Message------- From: Smita Manohar Date: Monday, September 16, 2002 10:12:24 To: php-db@lists.php.net Subject: [PHP-DB] question regarding date format hi all, a simple question regarding date, but i stuck with it . havin a variable containing date as, $date_test = "2002-08-02"; now i want it should be printed like, August 02, 2002 i am doing this with the funcion : echo date("F d, Y", $date_test); but getting a strange result as, January 01, 1970 the same function working fine without second argument. ie, echo date("F d,Y") is printing current date in the specified format. what wrong im doing using $date_test ?? thanx and regards, smita. _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .

« previous php.db (#21784) next »