hi want to ask if it is possible to calculate date base on user input
example
user input date 15/11/23(this field is use for end of one process activity)the activity one need to take 5 days to complete from start date 9/11/2023 and end date 14/11/2023
from the input date it can calculate the date and get how many days it process one activity
hi,
Please look below documentation for date and time built in functions.
https://success.outsystems.com/documentation/11/reference/outsystems_language/logic/built_in_functions/date_and_time/
For your case you can utilize below "DiffDays" function to get the days difference between two dates.
i already use diffdays, but got error this one, trying to fix it , but had no clue
Are you trying to assign this expression result to variable with DateTime type? DiffDays outputs an integer, not a datetime.
Hi @fahmi saha,
You are assigning integar type of value instead of DateTime in the expression. After calculating the DiffDays you should convert that value to DateTime or you can change the DataType of the variable.
Hope this helps!
Use below method as per your use case:
if EndDate,CycleTime is known the use below:
AddDays(EndDate,CycleTime) will output startdate as DateTime
if StartDate ,CycleTime is known the use below:
AddDays(StartDate,CycleTime) will output Enddate as DateTime
if StartDate ,EndDate is known the use below:
DiffDays(StartDate,EndDate) will output CycleTime as integer
Calculating from another known date can be done using built-in functionality. If you want to know the time elapsed between two dates, then DiffDays is your friend.
If you want to know what is the "date <x> days away from specific date", AddDays provides the answer.
https://success.outsystems.com/documentation/11/reference/outsystems_language/logic/built_in_functions/date_and_time/#AddDays
It's not mentioned in the documentation or provided examples, but you can use negative values in the function to subtract days:
example:AddDays(#2015-09-14#, -10) = #2015-09-04 00:00:00#
AddDays(#2015-09-14#, -10) = #2015-09-04 00:00:00#
Hi
Already try AddDays(Startdate, CycleTime)? It will generate the End Date for one process