note 74169 added to function.date
| From: | chris at smitflinkmedia dot nl | Date: | Wed, 28 Mar 2007 13:04:22 +0000 |
| Subject: | note 74169 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124879@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 83.137.20.120
Probable Submitter: 82.173.135.79
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/74169
Del: integrated -- https://master.php.net/note/delete/74169/integrated
Del: useless -- https://master.php.net/note/delete/74169/useless
Del: bad code -- https://master.php.net/note/delete/74169/bad+code
Del: spam -- https://master.php.net/note/delete/74169/spam
Del: non-english -- https://master.php.net/note/delete/74169/non-english
Del: in docs -- https://master.php.net/note/delete/74169/in+docs
Del: other reasons-- https://master.php.net/note/delete/74169
Reject -- https://master.php.net/note/reject/74169
Search -- https://master.php.net/manage/user-notes.php