I am trying to parse the date I get from a JavaScript script evaluated using the rhino library into java.util.Date, can I convert org.mozilla.javascript.NativeDate to java.util.Date?
If I convert NativeDate to a string using the Context.tostring method, I get the date in the following format:
Wed Oct 12 2011 16:17:59 GMT+0200 (CEST)
How can I parse this string date representation into a java.util.Date object?
In the rhino
context.jsToJava(nativeDateObj, Date.class);
Bvesco . (java to js) - Context.javaTojs() . - javascript:
Context.javaTojs()
Object js = context.newObject(scope, "Date", new Object[] {date.getTime()});
js java ( ):
Date date = new Date((long) ScriptRuntime.toNumber(s));
You tried?
java.sql.Date.valueOf("date string");