×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
With most approaches, if the times are not converted to UTC time immediately, it is virtually impossible to account for the 1am-2am Fallback repeated hour.
That is because the Time would have to know if DST was active or Inactive. Which requires more information that in saved in the default timestamp.
If the Timestamp was converted to UTC time and that is the time being converted, then you can always convert back to the Time zone and know if you are were before DST change or after DST change.
If you have a UTC time you can then use QWCCVTDT and it will return the "Current Daylight Savings Time Indicator" for the time zone you are converting to.
Use WRKTIMZON to see all the time zones on your system.
When you know what time zone you are in, then you can use QWCCVTDT to convert from that time to the UTC time zone.
If converting old timestamps you can check the date against when the time zone entry was effective.
For the United States, I'd suggest checking out the History of Time on Wikipedia.
Here is an example to convert from the current version of Mountain time to UTC time.
NewTimestamp = AdjustTimestamp( RecordTimestamp : 'QN0700MST3' : 'Q0000UTC');
// An example of DST before 2006.
If %subdt(RecordTimestamp:*YEARS) < 2006 and %subdt(RecordTimestamp:*YEARS) >= 1987;
NewTimestamp = AdjustTimestamp( RecordTimestamp : 'QN0700MST' : 'Q0000UTC');
Endif;
When Dealing with the Current Time you can use something like this to generate the Unix Timestamp representation.
CEEUTCO gets the current system offset amount and can be used to convert a timestamp to the current unix time.
This does not work for prior timestamps which would need to know the status of daily savings time.
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Slanina, John via RPG400-L
Sent: Friday, May 3, 2019 9:45 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: Slanina, John <jslanina@xxxxxxxxxx>
Subject: Time zone for a Date and Time
Is there a way to know if a date and time is in the daylight time zone or the standard time zone via an RPGLE program ?
I need to take date and time to its unix timestamp value which is in UTC.
Thanks
John Slanina
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.