PDT to IST in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Nitin Gadge
Registered Member
Posts: 27
Joined: Tue Aug 20, 2013 11:32 am

PDT to IST in COBOL.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: PDT to IST in COBOL.

Post 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.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: PDT to IST in COBOL.

Post by Anuj Dhawan »

Subject line mentions about COBOL, I doubt it's to do with Forum!? :unknown:
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: PDT to IST in COBOL.

Post 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.
Nitin Gadge
Registered Member
Posts: 27
Joined: Tue Aug 20, 2013 11:32 am

Re: PDT to IST in COBOL.

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: PDT to IST in COBOL.

Post 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.
Nitin Gadge
Registered Member
Posts: 27
Joined: Tue Aug 20, 2013 11:32 am

Re: PDT to IST in COBOL.

Post by Nitin Gadge »

Thanks. I had to do it manually. But is there no in-built function in COBOL at all?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: PDT to IST in COBOL.

Post 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.
Nitin Gadge
Registered Member
Posts: 27
Joined: Tue Aug 20, 2013 11:32 am

Re: PDT to IST in COBOL.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: PDT to IST in COBOL.

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”