Thank you Birgitta! I think this will work well...
select Timestamp(Translate('2022-07-21T20:14:36Z', ' ', 'TZ')) + current timezone
from sysibm.sysdummy1;
2022-07-21 16:14:36.000000
I found this:
https://www.ibm.com/support/pages/determining-timezone-used-db2-server
select current timestamp as local,
current timezone as timezone,
current timestamp - current timezone as UTC
from sysibm.sysdummy1;
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Birgitta Hauser
Sent: Friday, July 22, 2022 1:59 AM
To: 'RPG programming on IBM i' <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Timestamps
AFAIK there is no direct conversion (neither in RPG nor in SQL) for this
format.
In pure RPG you have to deal with %XLATE and/or %SCANRPL to convert it into
a valid character representation of the timestam and then convert the
result.
With SQL it is a little easier, but you still have to remove T and Z:
Exec SQL SET :YourTimestamp = Timestamp(Translate('2022-07-21T20:14:36Z', '
', 'TZ'));
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization - Education - Consulting on IBM i
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
"Train people well enough so they can leave, treat them well enough so they
don't want to." (Richard Branson)
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Greg
Wilburn
Sent: Donnerstag, 21. Juli 2022 22:49
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Timestamps
Is there a slick way to compare the current UTC time with a character
"timestamp" value like this?
'2022-07-21T20:14:36Z'
This is for the token expiration for AWS. The timestamp formats for the
various services are different.
I was hoping not to have to do it manually by %SUBST or %SCANRPL (replacing
T and colons with period and removing the Z).
TIA
Greg
[Logo]<
https://www.totalbizfulfillment.com/> Greg Wilburn
Director of IT
301.895.3792 ext. 1231
301.895.3895 direct
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx<mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>
1 Corporate Dr
Grantsville, MD 21536
www.totalbizfulfillment.com<
http://www.totalbizfulfillment.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@xxxxxxxxxxxxxxxxxxxx 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.