and more in a single search tool across platforms. Read the announcement here. |
02/28/2024 03:49 AM
Hi All,
Do you have the correct date function for below use case. I need to use this condition in CreateAccJSON - REST connection
If create date is within 2 days of the current date it should print "false" or else it should print "true". I tried adding below condition but not working. Let me know if anyone has used the similar date functions.
\"license\":\"${((user.createDate)>=(Calendar.getInstance().getTime().minusDays(2)))?'false':'true'}\"
\"license\":\"${((user.createDate)>=(new SimpleDateformat('YYYY-MM-dd HH:mm:ss').format(Calendar.getInstance().add(Calendar.DAY_OF_MONTH,-2).getTime()))?'false':'true'}\"
\"license\":\"${ABS(DATEDIFF(CURDATE(), user.createdate)) <= 2}\"
\"license\": \"${DATEDIFF(NOW(), createdate) <= 2}\"
02/28/2024 05:38 AM
Hi @ShyamSrisailam , Not exact use case yet but I am using something like this in provisioning json.
{\"type\": \"AfterDateTime\",\"endDateTime\": \"${(Calendar.getInstance().getTime()+ 1).format(\"yyyy-MM-dd'T'HH:mm:ss\")}Z\"}
Hope you can drive your use case from it.
Thanks,
Amit
If this answers your query, Please ACCEPT SOLUTION and give KUDOS.
02/28/2024 05:47 AM
\"license\": \"${((Calendar.getInstance().getTimeInMillis() - user.createDate.getTime()) <= (2 * 24 * 60 * 60 * 1000)) ? 'false' : 'true'}\"
02/28/2024 09:36 AM
Thanks for the response.
@AmitM - I need a syntax to minus 2 days from the current date and compare it with create date.
@rushikeshvartak - I have tried the syntax you provided but it's didn't work.
02/28/2024 07:50 PM
"license": "${(java.time.LocalDate.parse(user.createDate).isAfter(java.time.LocalDate.now().minusDays(2))) ? 'true' : 'false'}"
02/28/2024 07:50 PM
"license": "${java.util.Calendar.getInstance().getTime().getTime() - java.util.Calendar.getInstance().getTimeInMillis() >= java.util.Calendar.DAY_OF_MONTH * 2) ? 'true' : 'false'}"
02/28/2024 07:51 PM
"license": "${(java.util.Calendar.getInstance().toInstant().minus(java.time.temporal.ChronoUnit.DAYS, 2).isBefore(java.time.Instant.parse(user.createDate))) ? 'true' : 'false'}"
03/04/2024 02:36 AM
Hi @rushikeshvartak ,
I tried all the conditions you have provided but it's not working.
Logs says "\license\" was of unexpected type" and I think that target application is expecting result in Boolean value since the "License" attribute in target is Boolean Date Type.