42
Views
2
Comments
Calculate start date and end date difference
Question
Application Type
Reactive

Hi everyone

I am trying to calculate the difference between the start date. And End date.

How to calculate, please help

thanks and regards

vednarayan

mvp_badge
MVP

Hello Vednarayan.

There are multiple functions you can use to calculate the difference. You can have it in Days, Hours, Minutes or Seconds.

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Date_and_Time

If you need it has a DateTime, use the diffSeconds and calculate hours, minutes and seconds from it.

Seconds = DiffSeconds(StartDate,EndDate)

Time = NewTime(Trunc(Seconds/3600),Trunc(Mod(Seconds,3600)/60),Mod(Seconds,60))

I guess Vednarayan just need the days, so he could simply use the function:

DiffDays(dt1, dt2) returns the difference in days between 'dt1' and 'dt2'; i.e. how many days have passed between these two dates:

• Returns a positive number if 'dt1' is smaller than 'dt2';
• Returns a negative number if 'dt1' is bigger than 'dt2';
• Returns 0 if the two dates are equal.

The Time component you provide in the parameters is ignored. The DiffDays function receives two Date Time parameters, and then replaces the Time component with 00:00:00.

Vednarayan, did this help? Let us know!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.