RE: [PHP-DB] MySQL date formats
| From: | Rick Emery | Date: | Thu, 20 Dec 2001 17:50:47 +0000 |
| Subject: | RE: [PHP-DB] MySQL date formats | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15159@lists.php.net to get a copy of this message | ||
Try in PHP. This should take "12/25/2001" in $input_date and convert it to
"20011225" in $db_date. Then write $db_date to mySQL database.
Perform similar conversion when extracting from database.
Or instruct your users to use YYYYMMDD.
$thedate = explode("/",$input_date); //$thedate[0]=DD, $thedate[1]=MM,
$thedate[2]=YYYY
$db_date = date("Ymd", mktime(0,0,0,$thedate[1],$thedate[0],$thedate[2]) );
-----Original Message-----
From: nautilis [mailto:josemsala@hotmail.com]
Sent: Thursday, December 20, 2001 11:11 AM
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