Answered question

How can I cast an extracted variable type timestamp to type date?

From a webpage response, I extracted in a variable, a list of data (type timestamp).
Then I have to post a message with this data but in datetime format (AAAA-MM-DDThh:mm:ss).

How can I cast an extracted variable type timestamp to type date?

Eric N.
Eric N.

Eric N.

Level
0
80 / 100
points
Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

This kind of Javascript should convert a timestamp to a date format:

var myvalue = context.variableManager.getValue("Extracted");// Extracted is your variable extractor name
var mydate = new Date(0);
mydate.setUTCSeconds(myvalue);
logger.debug("new format="+mydate);

You may need to customize it so it can suit your need.

Did you find this useful ?

No (0)

Yes (0)

0% of users found this answer useful