note 22667 deleted from function.time by aidan
| From: | aidan@php.net | Date: | Sat, 08 Oct 2005 01:07:32 +0000 |
| Subject: | note 22667 deleted from function.time by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96642@lists.php.net to get a copy of this message | ||
Note Submitter: mwwaygoo at hotmail dot com
----
If you are storing the date and time in a MySql database, I have found storing the time stamp as an
INTEGER difficult to read when checking through the raw data. You can save a time-stamp into a
datetime type and it becomes readable.
BUT when you retrieve the data it comes back as 2000-06-05 12:15:01.
Make sure your select queries use the date in this format, otherwise they give bad results, and
format your retrieved entries so they are usable.
e.g.
This will give the individual entries
$my_date="2002-06-26 13:30:00";
list($year,$month,$day,$hour,$min,$sec)=explode(":", eregi_replace("['
'|-]",":", $my_date));
This will format your timestamp into a format used in your queries
$sql_query = "SELECT ... WHERE valid_until>=1025092140";
change to :
$sql_query = "SELECT ... WHERE valid_until>='" . date("Y-m-d
H:i:s",1025092140) . "'";