× 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.



John,

Below is a utility I wrote for my shop doing the opposite. I was taking a UTC Date/Time(represented in milliseconds) and translating into a RPGLE TimeStamp taking into consideration Daylight savings time using IBM-I Api 'CEEUTCO' that is aware of DST from the sys value QUTCOFFSET. You should be able to do the opposite to generate a UTC Time/Date aware of DST. I didn't have the need to write the utility generating the UTC . Hope this helps,

P.S, I needed to take the UTC time in milliseconds and change it to Seconds so I didn't blow up converting to a timestamp

CTL-OPT Nomain;
//**********************************************************************
// *
// 02/04/97 - This module Returns Local Timestamp for a UTC *
// Timestamp in Milliseconds Passed *
// *
// - Service program name = DATEUTIL *
// *
//**********************************************************************
/Copy $Dateproto
//**********************************************************************
DCL-S BaseTs TIMESTAMP Inz;
DCL-S #Ts TIMESTAMP Inz;
DCL-S #Seconds PACKED(15);

DCL-PR GetUTCOffset Extproc('CEEUTCO');
Hours INT(10);
Minutes INT(10);
Seconds FLOAT(8);
FC CHAR(12) Options(*Omit);
END-PR;

DCL-PROC $DATEUTCTS EXPORT;

DCL-PI $DATEUTCTS TIMESTAMP;
@UTCTS PACKED(13) VALUE;
@Format CHAR(1) VALUE Options(*Nopass);
END-PI;

DCL-S UTCOfsHrs INT(10);
DCL-S UTCOfsMins INT(10);
DCL-S UTCOfsSecs FLOAT(8);
DCL-S #Format CHAR(1);
// - - - - - - - - - - - - - - -
// Default to Millisecnds Passed
// - - - - - - - - - - - - - - -
If %Parms() = 1;
#Format = 'M';
Else;
#Format = @Format;
EndIf;
//
If #Format = 'M';
#Seconds = @UTCTS * .001;
Else;
#Seconds = @UTCTS;
EndIf;
//
BaseTs = %TimeStamp('1970-01-01-00.00.00.000000');
//
GetUTCOffset(UTCOfsHrs :UTCOfsMins :UTCOfsSecs :*omit);
#Ts = BaseTs + %Seconds(#Seconds) + %seconds(%int(UTCOfsSecs));
//
Return #Ts;
//
END-PROC $DATEUTCTS;

Wayne Achenbaum
Slomin's Inc.


This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate,distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Slanina, John via RPG400-L
Sent: Friday, May 3, 2019 11: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



--
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://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=1xMkjMdJ_kMQsRlJoQQzRw&r=gqvADjBkEbHU0FiPFIWZ_auombFJJAX_jfDA4QnWjYc&m=BKfQAYRq-c40nSYjCIVNtBnPlN4ZI7ht4FGM1WTGxdg&s=zfwVhMWWG1urPxWmyF2XtmR34QYehXs9fX2c-0YpfwI&e=
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=1xMkjMdJ_kMQsRlJoQQzRw&r=gqvADjBkEbHU0FiPFIWZ_auombFJJAX_jfDA4QnWjYc&m=BKfQAYRq-c40nSYjCIVNtBnPlN4ZI7ht4FGM1WTGxdg&s=I9zd1aJjcwGDSnm9VEytB9Bzz0_A-rBXS7gT9EsPxaE&e= .

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwICAg&c=1xMkjMdJ_kMQsRlJoQQzRw&r=gqvADjBkEbHU0FiPFIWZ_auombFJJAX_jfDA4QnWjYc&m=BKfQAYRq-c40nSYjCIVNtBnPlN4ZI7ht4FGM1WTGxdg&s=DATFwUpz_feP-H2hgNNNePIxWX9FXS-c4be-nz509is&e=

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.