Hello Experts,
In SAC Application Designer, I have a requirement to get the user input date(DD/MM/YYYY) and internally compute DD/MM/YYYY -2 days( Given Date - 2) in script , this date will be passed to the CDS query as input parameter. As of now I want to perform this calc in frontend and not in CDS level.
The problem I am facing is to convert DD/MM/YYYY to internal Java Script Date format,
I have tried the below 2 options, but it doesn't work
1. var day_ext = Input_Date.getValue(); // day_ext will have the date in DD/MM/YYYY
var mydate = new Date(day_ext);
console.log(mydate.toDateString()); // Error message - String cannot be converted to Integer
So I tried to use the below function to convert string to integer and then used the integer output to get internal date format, but it doesn't work aswell.
2. var datem2 = day_ext.substring(6, 10)+day_ext.substring(3, 5)+day_ext.substring(0, 2); //yyyymmdd, tried all other format var Dateint = ConvertUtils.stringToInteger(datem2);
console.log(Dateint); // The format of Dateint is yyyymmdd in integer
Can you please let me know how can we convert DD/MM/YYYY to integer value equivalent to date, which can be used to get the SAC date format.
Regards,
B