View previous topic :: View next topic
|
Author |
Message |
nareshdacha
New User
Joined: 12 Jan 2010 Posts: 66 Location: US
|
|
|
|
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 |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6967 Location: porcelain throne
|
|
|
|
are you on a mainframe or server version of db2? |
|
Back to top |
|
 |
Bill O'Boyle
CICS Moderator

Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
|
|
|
|
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.
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 |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1348 Location: Israel
|
|
|
|
This might work if you are in the said timezone:
Code: |
SELECT (my_timestamp_in_gmt + CURRENT TIMEZONE) FROM ... |
|
|
Back to top |
|
 |
|