As others have implied, the reason you have not gotten a simple answer is that 
there is not simple answer. It's a nasty problem. Local time does what JCL and 
Hoover vacuum cleaners do.

It is particularly nasty for historical times as opposed to times "right around 
now" because the dates and geographies of DST have changed from year to year.

As Gil pointed out, but you may have missed given the volume of replies, a 
complete solution is in fact impossible. Given a New York local time of 1:30am 
on the Sunday of the Fall DST change, what is the corresponding UTC time? It is 
impossible to know without knowing "which 1:30 am?" -- the one before setting 
the clocks back, or the one after?

I don't understand your question about "when adjusted for UTC falls within the 
DST period." UTC has no DST. A time adjusted or converted to UTC never has a 
further DST adjustment applied.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Hardee, Chuck
Sent: Saturday, June 28, 2014 11:54 AM
To: [email protected]
Subject: Re: Local Time conversion to/from UTC Time

Doesn't help, sorry.

Given all the answers I've had so far, all pointing to things implying 
real-time conversion of timestamps, I think it is clear that I haven't stated 
my need very well.

I have two (currently) sets of data. The data is historical. I have no control 
on how the data is produced, it's from a vendor product which shall remain 
nameless and is irrelevant. In the previous version of the product, both sets 
of data were saved with local times. In the current product, one set is saved 
in UTC, the other in local. The next version will save both sets of data in 
UTC. That being said, I need to be able to convert to and from local times and 
UTC times. And, let me say now, when I say "time", I mean a timestamp 
consisting of yyyy/mm/dd hh:mm:ss.tttttt, that is year, month, day, hour, 
minutes, seconds and microseconds.

I currently have routines to determine the range of Daylight Savings Time, or 
as some of indicated, Summer Time, and other names, all boiling down to the 
same thing.

I have a mechanism to obtain the offset to UTC as a signed value indicating 
before or after UTC, for example. On the East Coast of the US, the UTC offset 
is -5 hours (non-DST) and -4 hours (DST), meaning behind UTC.

The issue becomes when I have a local time that falls outside of the DST period 
but when adjusted for UTC falls within the DST period. Does it get adjusted?

For example, given a time of 01:59:59.999999 on the day of the switch to DST, 
when the UTC adjustment is made (assuming my US East Coast example), the time 
would be 06:59.59.999999. Now, the local time was outside the DST range, but 
when adjusted to UTC it falls within the DST range. Does the adjusted UTC time 
get adjusted for DST? And then, having gone thru the narration for local to 
UTC, a similar questions exists for UTC to local, and then similar questions 
regarding the other end of the DST period.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to