Hi Friends,
I am having two-time variable when I get different between from and to time, its not coming as expected, please anyone can help for the below scenario.
For example:
My start time is 3:00:22 and my end time is 03:27:11 so here I am using to get the diff between these two time is
NewTime(DiffHours(StartTime,EndTime),Mod(DiffMinutes(StartTime,EndTime),60),Mod(DiffSeconds(StartTime,EndTime),60)
its giving 00:27:49 instead of 00:26:49, can any one help on these scenario.
Thank you.
Hi Balaji,
DiffMinutes return only in minute diffrence.
Use this expression-
NewTime((DiffSeconds(StartTime,EndTime)/3600),Mod(DiffSeconds(StartTime,EndTime)/60,60),Mod(DiffSeconds(StartTime,EndTime),60))
It will give you actual result.
Hope this will help you.
Regards
Rahul
Rahul Sahu wrote:
Thank you Rahul
It working as you said.
Hello Balaji.
Let's see this step by step:
0 hours, 27 minutes and 49 seconds.So the value is right.
The ideal way is to work with seconds only NewTime(0,0,DiffSeconds(StartTime,EndTime)) will give you the right time.
Nuno Reis wrote:
Thank you Nuno for your guidance.
Welcome @Balaji..
Cheers
No problem.
A small correction on my formula: it is not NewDate(0,0,DiffSeconds(Time1,Time2)). Because the number of seconds in invalid.
But it works on AddSeconds(NullDate(),DiffSeconds(Time1,Time2))
Hi all,
Just a warning on using DiffSeconds, when using to calculate time between dates longer apart from each other than 68.10 years:
The maximum supported value is (2^31)-1 seconds. This corresponds to approximately 68.10 years. If DiffSeconds(dt1, dt2) is bigger than (2^31)-1, you will get an unexpected value.
Regards,
Daniel