Is there a way to easily convert a (past) datetime value given in one timezone into another one?
Typically I'm receiving a string like "2014-10-18T10:05:10Z" and I would like to know what date and time it was using Paris timezone.
I'm able to parse the datetime value without problem but I'm stuck with the timezone conversion (nothing seems to be provided in timezone library where such function should reside IMHO).
Timezone conversion
Timezone conversion
AmigaOne X1000 running AOS 4 beta
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
Re: Timezone conversion
Unfortunately there is no function (yet) in AmigaOS for this task. This is why YAM is using libtz to do the necessary conversion and to decide wether the given date/time was within DST or not. timezone.library can tell you if DST is active now, but not for an arbitrary date/time in the past or in the future. This is definitely something that needs to be added.
Re: Timezone conversion
Is binary port of libtz publically available somewhere?
I agree this is something that would be nice to address in the future. timezone.library autodoc currently seems to have plenty of room for such a thing
I agree this is something that would be nice to address in the future. timezone.library autodoc currently seems to have plenty of room for such a thing
AmigaOne X1000 running AOS 4 beta
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
Re: Timezone conversion
I doubt it. At least for YAM we are building libtz from scratch. It is only a very few files:abalaban wrote:Is binary port of libtz publically available somewhere?
libtz in YAM
And it requires the zoneinfo files for all the different locations on earth, each with its specific rules when DST was active in the the past.
- nbache
- Beta Tester
- Posts: 1716
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Timezone conversion
Timezone.library already comes with the .timezone files (XML-based) which are installed in Locale:Timezones. Would it be possible/preferable to base any solution on those instead, so as not to need two different sets of files with (I assume) more or less the same info?tboeckel wrote:And it requires the zoneinfo files for all the different locations on earth, each with its specific rules when DST was active in the the past.
Best regards,
Niels
Re: Timezone conversion
No I doubt it because files used by libtz seems to be binaries while files from the timezone.library are (proprietary) xml files. I guess the only solution is to add such feature (convert an arbitrary date from a specified TZ to another one) to the timezone.library.
AmigaOne X1000 running AOS 4 beta
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
- nbache
- Beta Tester
- Posts: 1716
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Timezone conversion
Yes, that was one of the solutions I hoped for to avoid duplicating the info in two types of files . That would be perfect, IMHO.abalaban wrote:I guess the only solution is to add such feature (convert an arbitrary date from a specified TZ to another one) to the timezone.library.
Best regards,
Niels
Re: Timezone conversion
I think the timezone files in Locale/Timezones only contain current timezone data (change dates for DST). We would need the historical timezone data to account for changes in the DST dates. For example, the DST (daylight saving time) change dates in the U.S. were changed several years ago. Any calculations based on the current DST dates would be incorrect for dates preceeding those changes.nbache wrote:Yes, that was one of the solutions I hoped for to avoid duplicating the info in two types of files . That would be perfect, IMHO.abalaban wrote:I guess the only solution is to add such feature (convert an arbitrary date from a specified TZ to another one) to the timezone.library.
AmigaOne X1000 with 2GB memory - OS4.1 FE
- salass00
- AmigaOS Core Developer
- Posts: 530
- Joined: Sat Jun 18, 2011 3:12 pm
- Location: Finland
- Contact:
Re: Timezone conversion
How many years would those "several years ago" be exactly?xenic wrote: I think the timezone files in Locale/Timezones only contain current timezone data (change dates for DST). We would need the historical timezone data to account for changes in the DST dates. For example, the DST (daylight saving time) change dates in the U.S. were changed several years ago. Any calculations based on the current DST dates would be incorrect for dates preceeding those changes.
If the change was made before the AmigaOS epoch (1.1.1978) then there isn't really any need to worry about it...
- nbache
- Beta Tester
- Posts: 1716
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Timezone conversion
Right, of course. So, if these data are part of the zoneinfo files, maybe it would be wiser to make timezone.library ale to use thos instead of the ons it uses now.salass00 wrote:xenic wrote:I think the timezone files in Locale/Timezones only contain current timezone data (change dates for DST). We would need the historical timezone data to account for changes in the DST dates.
No, there have been several changes, the latest in 2007:How many years would those "several years ago" be exactly?For example, the DST (daylight saving time) change dates in the U.S. were changed several years ago. Any calculations based on the current DST dates would be incorrect for dates preceeding those changes.
If the change was made before the AmigaOS epoch (1.1.1978) then there isn't really any need to worry about it...
http://en.wikipedia.org/wiki/History_of ... light_Time
And other places in the world have made changes as well within the Amiga epoch.
Best regards,
Niels