Page 1 of 1

PDT to IST in COBOL.

Posted: Wed Aug 01, 2018 6:38 pm
by Nitin Gadge
Hii All,

I wanted to convert my current time stamp to india time zone stamp. Like PDT to IST.

Can any one help me. My current timestamp is PDT (US ) in my system. Now I have to populate indian time.

Re: PDT to IST in COBOL.

Posted: Wed Aug 01, 2018 7:03 pm
by Robert Sample
Assuming you meant on this forum and not on your mainframe, go to the User Control Panel, click on the Board Preferences tab, and change the time zone there. Don't forget to Save your change.

Re: PDT to IST in COBOL.

Posted: Wed Aug 01, 2018 10:03 pm
by Anuj Dhawan
Subject line mentions about COBOL, I doubt it's to do with Forum!? :unknown:

Re: PDT to IST in COBOL.

Posted: Thu Aug 02, 2018 12:29 am
by Robert Sample
The easiest way is to adjust manually the date / time.

However, Language Environment (LE) has CEEFTDS and CEESETL run time functions which may accomplish what you want -- I haven't tested them so I'm not aware of how they work nor what they return. You may want to look through https://www-01.ibm.com/servers/resource ... 0_v2r3.pdf to see if what you want can be done through LE.

Re: PDT to IST in COBOL.

Posted: Thu Aug 02, 2018 6:29 am
by Nitin Gadge
enrico-sorichetti wrote: Thu Aug 02, 2018 12:12 amadd/subtract the appropriate time zone correction factor
In that how do I take care about the day light saving?

Re: PDT to IST in COBOL.

Posted: Thu Aug 02, 2018 7:34 am
by Robert Sample
If you are talking about, specifically, PDT to IST then you merely need to know the dates for going to (second Sunday in March) and returning from (first Sunday in November) daylight savings time each year; if the date you are looking at is within the daylight savings time window you adjust for it. Since the local time goes forward an hour in March and goes back an hour in November, your adjustment will be one hour. Since IST is GMT+5:30 and PST is GMT-8 (and PDT is GMT-7), you merely have to add 12 hours 30 minutes (for PDT) or 13 hours 30 minutes (for PST) to the time to convert to IST. This may require adjusting the date, of course.

The general case is much harder, since not all parts of the US use daylight savings time (the states of Arizona and Hawaii and the US possessions, notably -- although the Navajo Nation part of Arizona does observe daylight savings time). And some of the states are split between time zones.

Re: PDT to IST in COBOL.

Posted: Thu Aug 09, 2018 5:25 pm
by Nitin Gadge
Thanks. I had to do it manually. But is there no in-built function in COBOL at all?

Re: PDT to IST in COBOL.

Posted: Thu Aug 09, 2018 5:57 pm
by Robert Sample
But is there no in-built function in COBOL at all?
Why not check the Enterprise COBOL Language Reference manual yourself? If you do, you will discover that there are some date-related intrinsic functions but there are NO time-related intrinsic functions. So the answer to your question is that there are plenty of built-in functions in COBOL, but none of them deal with time or time offsets.

Re: PDT to IST in COBOL.

Posted: Mon Aug 13, 2018 4:41 pm
by Nitin Gadge
Thanks Robert. I was working at a company where they had a common routine whcih was used to do something very similar which I required. But I have used that module for date conversion, like Gregorian to Julian, vice versa on many other formats. It allowed to change the time also. But I think it was written by someone in that company only.

Re: PDT to IST in COBOL.

Posted: Mon Aug 13, 2018 5:54 pm
by Robert Sample
Yes, such routines are pretty common at mainframe sites. They were typically written to meet the site's specific needs and hence you have to adapt to the new routine as you move from site to site.