Hi,
I saved 2 dates into string variables.
How can i compare those date? (greater than)
How can i add 1 month to the date?
Please provide some solution for me
Hi,
I saved 2 dates into string variables.
How can i compare those date? (greater than)
How can i add 1 month to the date?
Please provide some solution for me
Hi @Zayn
You should first have both dates in date format (convert string to date:https://kb.workfusion.com/display/RPAe/Variables#Variables-ConvertStringtoDate ). Then you should be able to compare them.
I am not sure if date operations like adding 1 month is available yet: Date operations in Workfusion
I know the way to convert string to date.
But what is the way to compare both date?
Can you describe in details.
Still finding a way to add month in a faster way
I haven’t tried it but for the comparison I believe you could use the if-condition
IF date1 is greater than date2
Hi @Zayn
There is no ready action for adding a month, but you can do it using a custom action.
@CustomScriptAction(
input = ['date1'],
output = 'date2'
)
def customeScript() {
date2 = date1.plus(java.time.Period.ofMonths(1))
}
How about comparing two dates?
The date comparison doesn’t work when the 2 dates fall in different years.
In my scenario i have to capture a date and then add 30 days to it which i did using the custom script, and then compare if the date <= Current Date
This comparison fails when the dates fall in different years.
For e.g. Date1 = 12/30/2019 & Date2 = 12/30 + 30 days = 1/29/2020
Obviously Date2 is > Date1 but for some reason it calculates Date1>Date2
Is that a known issue in RPA/SPA?
Hi,
I’m storing them in a string variable.
To compare dates, you need to reformat them to DateTime variables using Date Format action.
Thank you so much.
It worked
Format the date in YYYYMMDD format if you want to compare using string format
Sorry but it didn’t work.
Only the DateTime variable comparison works.