Re: Date formatting

From: Date: Tue, 11 Dec 2001 21:15:28 +0000
Subject: Re: Date formatting
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77351@lists.php.net to get a copy of this message
Try using the DATE_FORMAT() function within your SQL query string... $query = "SELELCT DATE_FORMAT (your_date_column, '%M %d %Y') FROM your_table"; where: %M is the month in full text %d is the numerical day of the month with leading zeros %Y is the four digit year Extract the results as ussual... mysql_fetch_row() or mysql_fetch_array() or whatever you would use. Let me know if this works becuase I've not tried it before. Seems like it should work though. Good luck. :-) -Kevin Stone ----- Original Message ----- From: "phantom" <phantom@phantomcougar.com> To: <php-general@lists.php.net> Sent: Monday, December 10, 2001 8:35 PM Subject: [PHP] Date formatting > What would be an easy what to format a date value into month day year?? > I want to specially display a date stored in mysql in date format > YYYY-MM-DD > > The manual says: string date (string format, int [timestamp]) > > I tried $FormattedDate = date("F y, Y",${StoredDate}) > > 1999-04-15 spit out December 31, 1969 when I had hoped for April 15, > 1999. > > Apparently YYYY-MM-DD is not a valid timestamp... i tried mysql formats > of timestamp(8) and timestamp(14) and that didn't work either > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#77351) next »