Subject | Re: Re Elapsed time in timestamps and truncations |
---|---|
Author | Ali Gökçen |
Post date | 2006-04-20T06:53:51Z |
Hi Adam,
...
damn! where did come from my const 84000 ? :)
there should be some neuron lost in my bioHW..
JIT to be retired. ;)
to clearfy my previous mails:
cast(timestamp2-timestamp1 as number(18,5))
gives result like 2.25000.
this means 2 full days (2*86400) plus 25% of 86400.
86400 * 0.25 = 21600 seconds.
21600 / 3600 = 6 Hours.
2.25*86400 = 194400 -- integer.
days = 194400 / 86400 = 2 -- integer, (172800 seconds)
194400 - (86400 * 2) = 21600 -- remainder time, 6 hours
mytime = cast('00:00' as time) + 21600 -- 06:00:00
extract hours, minutes seconds from it.
or manualy:
hours=21600/3600 = 6
mimutes=(21600-(3600*6))/60 = 0
2 days, 6 hours, 0 minute, 0 seconds.
Regards,
Ali
...
> interested in the second components, if you want seconds then it is...
> 86400 that you must multiply by.
>24*60*60 = 86400 !
> Adam
>
damn! where did come from my const 84000 ? :)
there should be some neuron lost in my bioHW..
JIT to be retired. ;)
to clearfy my previous mails:
cast(timestamp2-timestamp1 as number(18,5))
gives result like 2.25000.
this means 2 full days (2*86400) plus 25% of 86400.
86400 * 0.25 = 21600 seconds.
21600 / 3600 = 6 Hours.
2.25*86400 = 194400 -- integer.
days = 194400 / 86400 = 2 -- integer, (172800 seconds)
194400 - (86400 * 2) = 21600 -- remainder time, 6 hours
mytime = cast('00:00' as time) + 21600 -- 06:00:00
extract hours, minutes seconds from it.
or manualy:
hours=21600/3600 = 6
mimutes=(21600-(3600*6))/60 = 0
2 days, 6 hours, 0 minute, 0 seconds.
Regards,
Ali