Re: PHP and MySQL date

From: Date: Tue, 16 Dec 2003 00:27:29 +0000
Subject: Re: PHP and MySQL date
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172767@lists.php.net to get a copy of this message
Cesar Aracena wrote:
Hi all, I'm making a site and need some tables from wich I can extract date, time and/or date/time later with PHP and I neved had very clear the way the possible formats work with each other so my question is what is the best (or recommended) method to store dates and/or times in a MySQL DB for PHP to work later? Thanks in advanced, ___________________________ Cesar L. Aracena Commercial Manager / Developer ICAAM Web Solutions 2K GROUP Neuquen, Argentina Tel: +54.299.4774532 Cel: +54.299.6356688 E-mail: lists@icaam.com.ar
The best way is to use a datetime or timestamp type in MySql, depending on your use of it. Using MySql's types allows you to use MySql's date comparison and functions for queries. You can get a UNIX timestamp using the UNIX_TIMESTAMP() function in mysql or by using strtotime() in PHP on the value. -- paperCrane <Justin Patrin>

« previous php.general (#172767) next »