DavidCB
15th May 2003, 18:27
Hi, I have two utc dates and I need to get the difference between this two dates but in hh:mm:ss. In this moment I use this tag to make it possible:
time.diff=whinh200.odat-tdsls400.odat
... and the report format is %U001, but this case gives me an +1 hour of the true time. Why?
Thanks in advance
NPRao
15th May 2003, 20:22
David,
Try this-
string temp(80)
temp = sprintf("%u002 %U001", utc.field-name, utc.field-name)
you get the output in date time format as - 04-24-03 20:13:43
DavidCB
16th May 2003, 10:11
Thanks for your response NPrao but this code returns me the first
date-time but not the difference:
temp = sprintf$("%u002 %U001", utc.field-name, utc.field-name)
----------------------------------------\ _________/
------------------------------------------------|
----------------------------------------returns me this
------------------------------------------date- time
Excuse my English
kevobr
16th May 2003, 11:48
Yes date calc does seem to 1 hour out. e.g.
15052003 11:54:30 = 1052996070
24012004 11:56:26 = 1043409386
Diff = 9586684 which should be 110 days 23 hours 58 minutes and 4 seconds
110 days = 9504000
leaving 82684 = 22:58:04 not 23:58:04
kevobr
16th May 2003, 11:55
Wonder if it has anything to do with clocks going forward or backwards on the servers for daylight saving time?
Does Baan automatically take an hour off DST times to synch them with GMT?
So in previous example 15052003 11:54:30
becomes 15052003 10:54:30
and calculated difference is correct
DavidCB
16th May 2003, 13:21
Finally I have used this code to solve the problem:
double days,hours,minutes,seconds,time.diff
time.diff=whinh200.odat-tdsls400.odat
days=round(time.diff/86400,0,0)
hours= round((time.diff-86400*days)/3600,0,0)
minutes=round((time.diff-86400*days-3600*hours)/60,0,0)
seconds=round((time.diff-86400*days-3600*hours-60*minutes),0,0)
Thank you all
NPRao
16th May 2003, 23:32
David,
Also refer to the link - How to read time stamp? (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=9832)