how to get time difference



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

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.
n_prudhvi
 
Posts: 1
Joined: Mon Dec 12, 2011 1:22 am
Has thanked: 0 time
Been thanked: 0 time

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

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?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

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
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post