rbv_api.toJSDate
Purpose
This function converts an input Date or Date/Time value into a Javascript native object.
Syntax
rbv_api.toJSDate(dateObject)
Parameters
dateObject
The input Date or Date/Time value to be converted into a Javascript native object.
Return Value
Javascript date object.
Example
This example shows the conversion of a Date or Date/Time value into a javascript object.
var x = rbv_api.selectValue("select createdAt from Customer where id=?", 15872);
var y = rbv_api.toJSDate(x);
rbv_api.println(rbv_api.getClassName(x));
rbv_api.println("x="+x);
rbv_api.println(rbv_api.getClassName(y));
rbv_api.println("y="+y);
This example shows the output for Graal JS.
com.oracle.truffle.polyglot.PolyglotMap
x=Sat Jan 22 2022 19:35:23 GMT-0600 (CST)
com.oracle.truffle.polyglot.PolyglotMap
y=Sat Jan 22 2022 19:35:23 GMT-0600 (CST)
This example shows the output for Rhino JS.
org.mozilla.javascript.NativeDate
x=Sat Jan 22 2022 19:35:23 GMT-0600 (CST)
org.mozilla.javascript.NativeDate
y=Sat Jan 22 2022 19:35:23 GMT-0600 (CST)