note 74169 deleted from function.date by bobby
| From: | bobby@php.net | Date: | Wed, 28 Mar 2007 15:19:39 +0000 |
| Subject: | note 74169 deleted from function.date by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124885@lists.php.net to get a copy of this message | ||
Note Submitter: chris at smitflinkmedia dot nl
----
Two tips/ notes:
* For everybody struggling with the (My)SQL and PHP date conversions, remember that (My)SQL has very
powerful date and time functions also. SELECT UNIX_TIMESTAMP(date) [...] returns the Unix timestamp
directly.
* Remember that the timestamp confirms to Daylight saving time. So one day after 24-01-2007 13:00
should be calculated like this:
$day_after = mktime(13, 0, 0, 3, 24+1,2007);
and not like:
$day_after = mktime(13, 0, 0, 3, 24,2007) + 24*60*60;
In this example, the first method might seem obvious, but in my particular example I already had a
timestamp and needed to add one day, without changing the time.
For the same reason, calculation the difference in days between two dates should always be rounded.