IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to convert GMT to CST/CDT Timezone


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Tue Jul 14, 2015 9:37 pm
Reply with quote

Hi,
I want to convert GMT to CST/CDT in DB2 (Table Data). The function/logic should work for regular and day light savings also. Please suggest how to perform this conversion.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed Jul 15, 2015 5:20 pm
Reply with quote

are you on a mainframe or server version of db2?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 15, 2015 6:16 pm
Reply with quote

I'm not DB2 literate, so here goes.

Is your LPAR set for US Eastern Time?

If you issue a COBOL FUNCTION CURRENT-DATE, bytes 17-21 will contain the GMT-Offset to Local. US Eastern Daylight Time is -0400 while Standard Time is -0500 (format "-/+HHMM"). You can also obtain this same offset separately (my own preference) via the LE Callable Service routine "CEEGMTO". Just add 01 HH for Central Time or ignore this altogether if your LPAR is US Central Time.

But, if MVS personnel don't require GMT (entirely possible), then the offset will contain +0000. icon_eek.gif

Use LE Callable Service routine "CEESECS" to convert the GMT to seconds, then adjust these seconds by subtracting the adjusted-offset (converted to seconds). Then use LE Callable Service routine "CEEDATM" to convert the adjusted seconds to your Central Time-Zone date/time stamp of "CCYYMMDDHHMMSS".

If you require Julian-Format, after Calling "CEEDATM" , use FUNCTION INTEGER-OF-DATE followed by FUNCTION DAY-OF-INTEGER, which will yield you your Julian-Date, with a format of "CCYYDDD".

HTH....
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Thu Jul 16, 2015 5:47 pm
Reply with quote

This might work if you are in the said timezone:
Code:
SELECT (my_timestamp_in_gmt + CURRENT TIMEZONE) FROM ...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts COnvert a column with mix of hex ,cha... DB2 5
No new posts To convert numeric to Packed Decimal DFSORT/ICETOOL 9
No new posts how to convert Hex String t char hex PL/I & Assembler 6
This topic is locked: you cannot edit posts or make replies. DFSORT-How to convert ZD to ZS in DFSORT DFSORT/ICETOOL 2
No new posts Convert a packed decimal value to zon... DB2 6
Search our Forums:

Back to Top