Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Create/Update User Request form - How to get local current date and time in form validations?

Jyostna111
New Contributor III
New Contributor III

Hi,

In the Create/update user request form validation for date field, we need to compare user start date with the current date. But the user's start date is in EST and the current date reference variable 'currentdate' available for validations is in UTC. Is there any way to convert the time zone for either of the dates to make a valid comparison? Or is there any other current date reference variable available for validations that provides the date/time in local time zone? 

6 REPLIES 6

CR
Regular Contributor III
Regular Contributor III

you can use below

DATEDIFF(user.STARTDATE, CURDATE())


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

Jyostna111
New Contributor III
New Contributor III

Hi Raghu,

It is erroring out when tried as a validation condition. I think MySql syntax will not work in form validations. It is all groovy.

Jyostna111_0-1710364994247.png

 

Regards

${(Date.parse("yyyy-MM-dd", orgenddate) >= enddate) && (enddate >=(startdate))}

Refer https://forums.saviynt.com/t5/third-party-access-governance/validation-of-user-form-date-fields-with...


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hi Rishikesh,

Thanks for sharing the code and the link. The issue there is about parsing the string to date. But in our case, we are looking for options to get the current date in local time zone and not in UTC.

 

Regards

Jyostna Yarlagadda

rushikeshvartak
All-Star
All-Star

It will validate against UTC only


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Jyostna111
New Contributor III
New Contributor III

I am able to derive the local/EST current date by using the code below in the form field validation where I need to restrict back-dated hires:

${hiredate-Date.parse("yyyy-MM-dd hh:mm:ss",new Date().format('yyyy-MM-dd hh:mm:ss',TimeZone.getTimeZone('EST'))) >= 0}

 

Thank for providing valuable suggestions!

 

Regards

Jyostna Yarlagadda