Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes


Accepted answer

Permanent link

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();

Ramkumar Raman selected this answer as the correct answer

0 votes

Comments

Hi Akash,

It's working in RPE thanks a lot.

Regards,
Ramkumar R



One other answer

Permanent link

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

0 votes

Comments

Hi Kumar,

Request you to provide a function to convert date&time("2015-07-03 18:01:08Z") to millisecond which is compatible with RPE.

Regards,

Ramkumar R

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jan 17 '18, 6:32 a.m.

Question was seen: 1,633 times

Last updated: Jan 19 '18, 2:13 a.m.

Confirmation Cancel Confirm