Difference between times
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai
Difference between times
Hi
Can anyone please tell me , is there any function or any way by which I can get the difference between two times.
i.e.
Column Type
A Time
B Time
A-B = Diff in seconds
Please note that the field type is Time,I found a function which takes Timestamp as input . SecondsSinceFromTimestamp
Thanks
Can anyone please tell me , is there any function or any way by which I can get the difference between two times.
i.e.
Column Type
A Time
B Time
A-B = Diff in seconds
Please note that the field type is Time,I found a function which takes Timestamp as input . SecondsSinceFromTimestamp
Thanks
Thanks
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
Hi there,
If you have two time columns like 20:20:20 as HH:MM:SS
then i think it can be done this way,
use hoursfromtime,minutesfromtime and secondsfromtime function in variables,
get the difference between two columns in variables in hours,minutes and seconds.
multiply diff in hr by 3600,min by 60 ,sec as it is.
add these and you will get the difference in seconds.
i havent tried it but i think it should work.
cheers,
ZDC
If you have two time columns like 20:20:20 as HH:MM:SS
then i think it can be done this way,
use hoursfromtime,minutesfromtime and secondsfromtime function in variables,
get the difference between two columns in variables in hours,minutes and seconds.
multiply diff in hr by 3600,min by 60 ,sec as it is.
add these and you will get the difference in seconds.
i havent tried it but i think it should work.
cheers,
ZDC
Zero Degree Consulting
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai
Thanks
I had thought of this....the problem comes when the time First is 23:59:58
and the second one is 00:00:00.
The calcuations would go for a toss....ideally it should come as 2 seconds.
since I donot have the date........its just time,it causes problems.
I have to track a 2 second difference between the two times.
I tried iconv too.....but the problem persits
Can you please suggest anything on this
I had thought of this....the problem comes when the time First is 23:59:58
and the second one is 00:00:00.
The calcuations would go for a toss....ideally it should come as 2 seconds.
since I donot have the date........its just time,it causes problems.
I have to track a 2 second difference between the two times.
I tried iconv too.....but the problem persits
Can you please suggest anything on this
ZDC wrote:Hi there,
If you have two time columns like 20:20:20 as HH:MM:SS
then i think it can be done this way,
use hoursfromtime,minutesfromtime and secondsfromtime function in variables,
get the difference between two columns in variables in hours,minutes and seconds.
multiply diff in hr by 3600,min by 60 ,sec as it is.
add these and you will get the difference in seconds.
i havent tried it but i think it should work.
cheers,
ZDC
Thanks
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai
I guess these would only take second's part
I have a scenario
the time First is 23:59:59
and the second one is 00:00:01.
Ideally the difference should be 2 seconds.
Would these work.
or some with time 23:55:22 and 23:59:24
I have a scenario
the time First is 23:59:59
and the second one is 00:00:01.
Ideally the difference should be 2 seconds.
Would these work.
or some with time 23:55:22 and 23:59:24
Maveric wrote:Look at the function SecondsFromTime(%time%). Read the documentation for it. SecondsFromTime(A) - SecondsFromTime(B) should work.
Thanks
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
Hi ,
while using hoursfromtime function if hours from Time 1 is greater than hours from Time 2 just add 24 to the time 2 hrs and then do the calculations.
eg.
Time 1 - 23:59:59
Time 2 - 00:00:01
if hoursfromtime(Time 1)>hoursfromtime(Time 2) then {hoursfromtime(time2)+24} else hoursfromtime.
so output will be (24-23)*3600+(0-59)*60+(1-59)
do this in stagevariable ,it will solve your problem.
Cheers,
ZDC
while using hoursfromtime function if hours from Time 1 is greater than hours from Time 2 just add 24 to the time 2 hrs and then do the calculations.
eg.
Time 1 - 23:59:59
Time 2 - 00:00:01
if hoursfromtime(Time 1)>hoursfromtime(Time 2) then {hoursfromtime(time2)+24} else hoursfromtime.
so output will be (24-23)*3600+(0-59)*60+(1-59)
do this in stagevariable ,it will solve your problem.
Cheers,
ZDC
Zero Degree Consulting