Rational Publishing Engine some functions are not working in javascript.
Hi,
We have written a JavaScript to calculate time difference between two data&time Data(Clearquest date&time format inputs "2018-01-16T10:26:32IST") and it will also calculate total time difference.
It's working in chrome browser but it's not working in RPE as java script(var from = new Date(fromIST)).
Please suggest that if there is any list of supported java function by RPE.
I am not sure about list of supported functions by RPE. If you have list of supported function catalog with you, Please share with us.
Regards,
Ramkumar R
Accepted answer
Hi Ram,
The following JS code will get you the time in milliseconds:
var dateStr = "2018-01-16 10:26:32IST";
var inputDateFormat = new java.text.SimpleDateFormat( "yyyy-MM-dd HH:mm:ssz");
var date =inputDateFormat.parse(dateStr);
date.getTime();
One other answer
Hi Ram,
You probably have to use java.util.Date. See some examples below.
https://rpeactual.com/2014/08/14/java-script-in-rpe-tipstricks-and-best-practices/
Additionally make sure you don't use any java or javascript keywords as variable names.
Thanks,
Kumar