Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
To validate the date parameter
Sankari
Hi all,
Could anyone help me how to validate the date parameter...i want to check the correct format of date(yyyy-mm-dd) while user entering this as parameter....
Thanks
Sankari.S
Find more posts tagged with
Comments
mwilliams
Hi Sankari,
What is the purpose for checking this? I believe that as long as the user enters a valid date, it should work.
keith_c06
Sankari,
This has worked for me. It displays an exception if it fails:
// begin code for validate event of parameter
importPackage(java.text);
var dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
try {
var tmp = dateFormatter.parse(params["yourDateParameter"].value;
true;
} catch (err) {
false;
}
// end code
This is based on the java.text.SimpleDateFormat class (I use it regularly in my java programming).
Good luck,
Keith