Fwd: Function mktime() documentation question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------- Forwarded message ----------
From: Andrew Ballard <aballard@xxxxxxxxx>
Date: Fri, Mar 9, 2012 at 12:53 PM
Subject: Re:  Function mktime() documentation question
To: Tedd Sperling <tedd.sperling@xxxxxxxxx>


On Fri, Mar 9, 2012 at 12:07 PM, Tedd Sperling <tedd.sperling@xxxxxxxxx> 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux