And again to the list, since for some reason "Reply-to-all" did not do
as intended this time.


---------- Forwarded message ----------
From: Andrew Ballard <aball...@gmail.com>
Date: Fri, Mar 9, 2012 at 12:53 PM
Subject: Re: [PHP] Function mktime() documentation question
To: Tedd Sperling <tedd.sperl...@gmail.com>


On Fri, Mar 9, 2012 at 12:07 PM, Tedd Sperling <tedd.sperl...@gmail.com> wrote:

[snip]

> I am just looking for one that is easy to explain to students.
>
> Cheers,
>
> tedd

tedd,

Since you are teaching this to students, I would recommend sticking
with the internal date functions and avoiding any solution that
includes adding or subtracting multiples of the magic number 86400.*
Many such "solutions" fail to take into consideration Daylight Saving
Time and are therefore guaranteed to be wrong at least twice a year
(if not several months out of the year). Sure, you can write your code
to handle the differences correctly, but since the rules governing the
time shift are mostly arbitrary and differ across time zones the world
over, it seems safer to me to rely on the internal functions when
working with dates.


Andrew


* Even if the internal functions base their calculations on the number
of seconds per day, they have at least already handled all the varied
time zones and DST rules and been tested in environments all over the
world. When those rules change, the internal functions will be
adjusted to reflect the changes and should be much more reliable than
thousands of instances of multiple strategies that get copied and
pasted into projects.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to