how to get time difference

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS
n_prudhvi
Posts: 1
Joined: Mon Dec 12, 2011 1:22 am
Skillset: cics,db2,jcl,cobol
Referer: google

how to get time difference

Postby n_prudhvi » Mon Dec 12, 2011 2:49 am

actually i need to find the time diff..the time values are in 24 hr format....n date n time values are separately defined ..


help me out

regards,
prudhvi.

BillyBoyo
Global moderator
Posts: 3805
Joined: Tue Jan 25, 2011 12:02 am
Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
Referer: Google

Re: how to get time difference

Postby BillyBoyo » Mon Dec 12, 2011 2:54 am

You have chosen section of the forum to ask the question.

Where do you need to know the time difference? Program? Database? What? If you give all the details, you'll be more likely to get a useful answer.

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

Re: how to get time difference

Postby Robert Sample » Mon Dec 12, 2011 3:21 am

Either you have not explained everything, or you've got a reason not to use your brain? First, decide if you need to result in nanoseconds, or seconds, or minutes, or hours, or whatever. Then, take your first value for seconds and subtract it from your second value for seconds. If you have a negative value, add 60 and subtract 1 from the minutes second value. Repeat for minutes and hours. You wind up with the difference in hours, minutes, and seconds (ignoring the days of course -- but accounting for days does not require a lot more effort, in thinking OR coding, to handle). So why are you not able to develop this algorithm yourself?

Anuj Dhawan
Posts: 272
Joined: Mon Feb 25, 2008 3:53 am
Skillset: None
Referer: Google
Location: Mumbai, India

Re: how to get time difference

Postby Anuj Dhawan » Tue Dec 13, 2011 7:21 pm

n_prudhvi - I've moved your topic to 'IBM Cobol' part of the Foum, though I'm not sure what kind of solution you might be looking for - but it did not belong to "suggestion & feedback" part of the forum for sure.
Anuj


  • Similar Topics
    Replies
    Views
    Last post