Re: PHP and MySQL date
| From: | Website Managers.net | Date: | Tue, 16 Dec 2003 00:23:09 +0000 |
| Subject: | Re: PHP and MySQL date | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172766@lists.php.net to get a copy of this message | ||
If you need to store both date and time, there are several ways to accomplish this. MySQL has
built-in date/timestamp options, but those long strings would need to be converted for be human
readable.
The option I use most is telling PHP what format I want to use and entering it into the database as
a variable character (VARCHAR) field.
$Today = date((Y-m-d H:i),mktime());
Returns: 2003-12-15 18:20
See the PHP help file for mktime() and date()
Jim
www.websitemanagers.net
----- Original Message -----
From: "Cesar Aracena" <lists@icaam.com.ar>
To: <php-general@lists.php.net>
Sent: Monday, December 15, 2003 5:23 PM
Subject: [PHP] PHP and MySQL date
| 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
|
| --
|