[Info-vax] EU will abandon daylight savings time in 2021
Arne Vajhøj
arne at vajhoej.dk
Fri Apr 5 06:48:06 EDT 2019
On 4/5/2019 4:27 AM, Jan-Erik Söderholm wrote:
> Den 2019-04-05 kl. 02:02, skrev Arne Vajhøj:
>> On 4/4/2019 6:08 AM, Jan-Erik Söderholm wrote:
>>> Den 2019-04-04 kl. 03:27, skrev Arne Vajhøj:
>>>> On 4/3/2019 1:37 PM, Jan-Erik Söderholm wrote:
>>>>> We have some local timestamps that has to be
>>>>> converted to GMT/UTC before sent to another system, and these are both
>>>>> from "winter time" and "summer time". We can of course hardcode the
>>>>> dates for the switches and compare, but it would be nice if the rule
>>>>> could be used...
>>>>
>>>> What do you have and what do you need to convert it to?
>>>
>>> An INTEGER "date" with format YYYYMMDD, ag 20190404 for today.
>>>
>>> A SMALLINT "time" with format HMM or HHMM, range from 1 (one minute
>>> after midnight) to 2359 (one minute before midnight). I guess
>>> it could be zero also for the first minute after midnight, but
>>> the system is having it's night-batch windows then.
>>>
>>> These two are in Swedish local time (winter or summer time).
>>>
>>> The target system uses Unix Epoch format (seconds since some date).
>>
>> I am not a Python expert, but it looks like:
>>
>> from datetime import date
>> import time
>>
>> v = 20190404
>> d = date(v / 10000, (v / 100) % 100, v % 100)
>> t = time.mktime(d.timetuple())
>>
>> works for the first conversion.
>
> No poblem, we have that part since some time. But to a
> epoch time in local time, not to GMT/UTC.
That code snippet returns UTC here.
But I admit that I did not test on VMS. I can try that.
Also note that it returns floating point not integer.
Arne
More information about the Info-vax
mailing list