Here you can find the source of toDate(final Object value)
public static Date toDate(final Object value)
//package com.java2s; //License from project: Apache License import java.util.Date; import jdk.nashorn.api.scripting.ScriptObjectMirror; public class Main { public static Date toDate(final Object value) { final Number time = (Number) ((ScriptObjectMirror) value).callMember("getTime"); return new Date(time.longValue()); }//from w w w . j a v a 2 s .com }