Re: Date problem

From: Date: Tue, 22 Aug 2000 05:45:11 +0000
Subject: Re: Date problem
Groups: php.general 
Request: Send a blank email to php-general+get-12875@lists.php.net to get a copy of this message
Addressed to: "Hector M Banda" <hector@need-info.com> php-general@lists.php.net ** Reply to note from "Hector M Banda" <hector@need-info.com> Mon, 21 Aug 2000 21:21:23 -0700 > > Hi all, > > let's say: thedate$ = "2000-12-31" > > how can I change the format to 12/31/2000? > > I've been looking into the date command but I get: date("mdY", > thedate$) ==> 31121969 2000-12-31 looks like it might be a database result. If so the best thing to is let the database do the date formatting. Believe it or not, I still have the URL for MySQL documentation on FORMAT_DATE function in my clipboard from the last time I answered this question... <paste> http://www.mysql.com/documentation/mysql/commented/manual.php?section=Date_and_time_functions It looks something like: SELECT DATE_FORMAT( SomeDate, '%m/%d/%Y' ) AS Date FROM Table; If that is not possible, try something like this... list( $Y, $M, $D ) = explode( '-', $TheDate ); $FormattedDate = date( 'm/d/Y', mktime( 0, 0, 0, $M, $D, $Y )); For more info: http://www.php.net/manual/ref.datetime.php Rick Widmer Internet Marketing Specialists www.developersdesk.com

« previous php.general (#12875) next »