Re: MySQL date formats

From: Date: Thu, 20 Dec 2001 17:46:25 +0000
Subject: Re: MySQL date formats
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15158@lists.php.net to get a copy of this message
in your select statement that you pull the date out with. wrap that column with SELECT UNIX_TIMESTAMP(<columnname>) FROM table; this will return the unix timestamp now with this format use the date() function and format the date how ever you would like. Jim ----- Original Message ----- From: "Rosser, Chris" <cyr13732@glaxowellcome.co.uk> To: <php-db@lists.php.net> Cc: "'nautilis'" <josemsala@hotmail.com> Sent: Thursday, December 20, 2001 9:36 AM Subject: RE: [PHP-DB] MySQL date formats > nautilis, > > Leave the date in the database in MySQL format (YYYY/MM/DD) and when you > need to display the date on your page, just do this: > > <?php > > explode("/", $datearray); > $date = $datearray[2].'/'.$datearray[1].'/'.$datearray[0]; > > ?> > > That just splits up the three numbers, and rearranges them. Easy :) > > Chris > }:) > > > -----Original Message----- > > From: nautilis [SMTP:josemsala@hotmail.com] > > Sent: Thursday, December 20, 2001 5:11 PM > > To: php-db@lists.php.net > > Subject: [PHP-DB] MySQL date formats > > > > Hi everyone! > > > > I have a little problem with my MySQL database in the way it stores dates. > > The only format i can have is YYYY/MM/DD, and when i request this date > > from > > my php page, this date is insertes in this format. As my website is going > > to > > be for spanish users, the correct format would be DD/MM/YYYY, but i have > > no > > idea about changing this, either on the database or when i process it with > > php. > > > > Thanks in advance for reading my post. I hope anyone can point me into the > > right direction. > > > > nautilis > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#15158) next »