John,
I had a similar problem. Had to determine if a given date, current or past, was standard or daylight savings (DST). Found a couple of XLS on-line, that I ported to tables on the IBM i, then wrote a couple of Java classes, as well. I chain in with the time zone name of the time zone I am working with (time zone names are standardized in name and format) and it returns me a timezone OID (to be used later). Then I pass in the date I wish to check, similar to your string format, and it returns the Unix timestamp value (that's in a Java class). Then, I set a pointer in the other table on the IBM i, using the OID and Unix timestamp and read the prior record. That will tell me if daylight savings started on the date or not. This table has every "spring forward/fall back" from when it first began and going forward for longer than any of us will be around, for every time zone in the world. So, for example, if you converted today (5/3/18) and then did the read prior logic, it would find a record for March 10th, and that record would say that DST began that day, so today we are currently in DST). There is a flag on each row of the table that DST starts, or not, on that date. It does not handle those places that do not change, like AZ and such, but for my purposes it was close enough. I did the conversions in Java, from string to timestamp, because it's a common conversion and I didn't find anything like it in RPG anywhere.
Steve Meisinger
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Slanina, John via RPG400-L
Sent: Friday, May 3, 2019 11:05
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: Slanina, John <jslanina@xxxxxxxxxx>
Subject: Re: Time zone for a Date and Time
Input is a string but can change '2019-05-01 11:00:00' the volume would be too high to call a web api.
Thanks
John Slanina
On 5/3/19, 11:50 AM, "RPG400-L on behalf of David Gibbs via RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx on behalf of rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:
On Fri, May 3, 2019 at 10:44 AM Slanina, John via RPG400-L
<rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:
> 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.
What's the input?
There appears to be various web api's available to determine timezone
information (although some aren't free).
david
--
IBM i on Power Systems: For when you can't afford to be out of business!
I'm riding 615 miles (Yes, you read that right) in the American
Diabetes Association's Tour de Cure to raise money for diabetes
research, education, advocacy, and awareness. You can make a
tax-deductible donation to my ride by visiting
https://mideml.diabetessucks.net.
You can see where my donations come from by visiting my interactive
donation map ...
https://mideml.diabetessucks.net/map (it's a geeky
thing).
I may have diabetes, but diabetes doesn't have me!
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.