Page 1 of 1

how to get time difference

PostPosted: Mon Dec 12, 2011 2:49 am
by n_prudhvi
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.

Re: how to get time difference

PostPosted: Mon Dec 12, 2011 2:54 am
by BillyBoyo
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.

Re: how to get time difference

PostPosted: Mon Dec 12, 2011 3:21 am
by Robert Sample
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?

Re: how to get time difference

PostPosted: Tue Dec 13, 2011 7:21 pm
by Anuj Dhawan
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.