John Bruin wrote:
> I have a script that calculates difference between dates and it works
> well. However if the 2 dates straddle our daylight saving times
> (March, October) then the result is either plus or minus an hour
> compared to the expected result.

Are you subtracting "dates" or "local time stamps?" In the abstract, "dates"
have no reference to time zones.

Give some examples of what you're trying to do. What is the "expected
result"?

If you switch from daylight savings time at 2am on Sunday, October 31, then
the difference between the local times of noon on Saturday the 30th and noon
on Sunday the 31st is 25 hours, not 24 hours. If you're expecting it to be
24 hours, that's not correct.

> 
> I am using date::parse (which uses Time::Local) to convert the date
> string to seconds and then localtime and strftime to convert back to
> a string. 

What are you converting back to a string? The difference between the epoch
seconds?

Note that epoch seconds are always in GMT (UTC). In order for your parsing
routine to convert a string expressed in some local time to epoch seconds,
it needs to know the offset from the local time to GMT, which is a function
of the time zone.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to