RE: [PHP] PHP/MySQL -- Date/Time Confusion
| From: | David Freeman | Date: | Fri, 12 Jul 2002 22:29:38 +0000 |
| Subject: | RE: [PHP] PHP/MySQL -- Date/Time Confusion | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107447@lists.php.net to get a copy of this message | ||
> Which method is the best way to store date/time in MySQL and
> then which PHP
> command is the best to use to convert that date to something
> useful?
Get comfortable with MySQL's date functionality and you'll find that you
don't often need to do the date comparisons and manipulation in php at
all.
MySQL lets you store date/time stuff as date, time or timestamp formats
(off-hand, haven't referred to the manual here) that will store the data
for you. You can manipulate this date information in your sql query
using things like DATE_FORMAT() and the like. Check the MySQL manual
for all of those (chapter 6 or 7 I think it is).
If you're mostly doing data extraction based on date criteria then
you'll find it works best as sql queries basically.
CYA, Dave