COBOL DATE FUNCTION
There was requirement were we had to send MT202 to Swift. Swift accepts time of GMT or either it accepts with correct offset and when we use current time option in COBOL it gives local time hence we were getting ET time.I had faced issue with time. The offset I was getting was not correct from GMT.
For E.g.: ET time is 4 hrs offset from GMT when day-light saving is on and it is 5 hrs offset from GMT when day light saving is off.
I used following function and by using this function we get the offset from GMT of where your application is running, then we can easily just use native COBOL.
http://publibz.boulder.ibm.
Positions 17-21 will give you the exact offset from GMT.
Unless your application is running in one of the time zones with 15 or 30 minute offsets from GMT, then "converting" from/to GMT becomes trivial without resorting to an LE call-able service (much less a C or Assembler subroutine).
Character 17 is sign value '-'or '+'. This sign is '-' if GMT is ahead of local time and '+' if the GMT is behind of local time.
No comments:
Post a Comment