Question
EY
US
Last activity: 22 Mar 2017 11:48 EDT
Date Format (YYYYMMDD) validation
Dear All
I have a string property in which user enters a date in yyyymmdd format. I need to validate to check it's in valid YYYYMMDD format, in the activity. I do not see any OOTB functions to validate the date. Can you please give me a solution on how to validate the string to contain valid YYYYMMDD date value.
Thanks
-
Likes (1)
Renuka Boddu -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
US
Hi Babu,
I had created a use case to validate the date string of format yyyyMMdd and its working fine as shown in the attachment. Kindly let us know if you need further help.
Regards
Mahesh
Pegasystems Inc.
IN
Hi,
You can create a edit validate rule to validate the format of the date and include it in the advanced tab of the property rule under Use Validate.
You can refer to the OOTB edit validate rules for a reference.
Regards,
Gisela
Pegasystems Inc.
IN
To add to Gisela's suggestion, You can validate the format at the property level using Edit-Validate rule. As a sample please check
NotFutureDate: Expects a string in theValue
in the format YYYYMMDD. This rule returns true if that date is today's date or a past date, or false if the date is a future date or not in the expected format.
Hope this helps.
Best Regards,
Mounika
Pegasystems Inc.
IN
More on this : https://collaborate.pega.com/question/how-allow-user-input-date-format-mmddyyyy
Best Regards,
Mounika
Pegasystems Inc.
IN
This is a candidate for client side validation since you want to enforce a particular syntax. Edit validate is the ideal way to achieve this.
May I also know the reason behind making it a String property. Date type property would have handled this automatically.
EY
US
Dear All
I missed one point. Actually the user updates the data in excel in character format and we are using MSOParseExcelFile to populate the excel data to Clipboard. I need to perform date validation on the clipboard to make sure tha value that the user entered is in YYYYMMDD format.
Pegasystems Inc.
IN
This needs to be validated on server side then.
Use the same logic mentioned in Datemmddyyyy (existing Validate rule name) and write your own java step/function to replicate the same logic for your date pattern. If the logic returns false, then set validation error message.
Let us know if this helps :)
Accepted Solution
Pegasystems Inc.
US
Hi Babu,
I had created a use case to validate the date string of format yyyyMMdd and its working fine as shown in the attachment. Kindly let us know if you need further help.
Regards
Mahesh