54
Views
5
Comments
Solved
Time Computation Problem

Hello Outsystems Community I'm a beginner here and I am having a hard time manipulating time in outsystem, I want to know how to calculate specific time difference of 2 variable, I tried the DiffHours(), DiffMinutes() and DiffSeconds() but it gives me a wrong computation I want it in a 00:00:00 time format.
 
Here's an attached OML if you are willing to help me for my problem thank you very much.

TimeDifferenceCalculation.oml
UserImage.jpg
Puja Rani
Solution

Hi,

You can use this expression. Below is output . Hope this helps.

NewTime((DiffSeconds(SelectTime1,SelectTime2)/3600),Mod(DiffSeconds(SelectTime1,SelectTime2)/60,60),Mod(DiffSeconds(SelectTime1,SelectTime2),60))

UserImage.jpg
Josiah Viernes

Hello Puja Rani, this code is very useful thank you unfortunately what if the time difference exceeds to 24hrs the code returns 00:00:00 value is there any way to fix this?
Thank you<3

UserImage.jpg
Puja Rani

Hi,

With time picker widget how are you trying that. You need a date time value if difference is more than 24hrs.

You can check the below forums.

https://www.outsystems.com/forums/discussion/85707/getting-the-dates-differences-in-ddmmhhss/

https://www.outsystems.com/forums/discussion/65105/diff-between-two-date-time/

https://www.outsystems.com/forums/discussion/57144/format-hours-minutes-and-seconds/

Additionally you can check below forge component code to see how they have calculated.

https://www.outsystems.com/forge/component-overview/8734/gettimediffrenceindays-hours-min-secs

UserImage.jpg
Josiah Viernes

I am now trying it into an attendance monitoring system that we made and now we are converting date time data type, We are computing sums of overtime, undertime and workhours and it exceed to 24 hours


Screenshot 2023-09-21 213034.png
Screenshot 2023-09-21 212856.png
2021-06-01 05-56-33
Komal Kumbhar

Hello Josiah,

Please check following discussions those are solved problems it may help you in your scenario as well,

https://www.outsystems.com/forums/discussion/85283/how-to-find-difference-of-two-date-time-attributes/

https://www.outsystems.com/forums/discussion/66145/exact-difference-of-two-date-and-time/

Hope this helps,

Komal

UserImage.jpg
Puja Rani
Solution

Hi,

You can use this expression. Below is output . Hope this helps.

NewTime((DiffSeconds(SelectTime1,SelectTime2)/3600),Mod(DiffSeconds(SelectTime1,SelectTime2)/60,60),Mod(DiffSeconds(SelectTime1,SelectTime2),60))

UserImage.jpg
Josiah Viernes

Hello Puja Rani, this code is very useful thank you unfortunately what if the time difference exceeds to 24hrs the code returns 00:00:00 value is there any way to fix this?
Thank you<3

UserImage.jpg
Puja Rani

Hi,

With time picker widget how are you trying that. You need a date time value if difference is more than 24hrs.

You can check the below forums.

https://www.outsystems.com/forums/discussion/85707/getting-the-dates-differences-in-ddmmhhss/

https://www.outsystems.com/forums/discussion/65105/diff-between-two-date-time/

https://www.outsystems.com/forums/discussion/57144/format-hours-minutes-and-seconds/

Additionally you can check below forge component code to see how they have calculated.

https://www.outsystems.com/forge/component-overview/8734/gettimediffrenceindays-hours-min-secs

UserImage.jpg
Josiah Viernes

I am now trying it into an attendance monitoring system that we made and now we are converting date time data type, We are computing sums of overtime, undertime and workhours and it exceed to 24 hours


Screenshot 2023-09-21 213034.png
Screenshot 2023-09-21 212856.png
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.