Java Nashorn Javascript Library toDate(final Object value)

Here you can find the source of toDate(final Object value)

Description

to Date

License

Apache License

Declaration

public static Date toDate(final Object value) 

Method Source Code


//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
}

Related

  1. isNashornScript(final String className)
  2. isNativeObject(final Object value)
  3. newObject()
  4. parse(final String code, final String name, final boolean includeLoc)
  5. rightAdjustCharHeadWithPrev(final int s, final IntHolder prev)
  6. toRegExp(String source, String optionsString)
  7. unwrap(final Object source)
  8. unwrapMap(ScriptObjectMirror jso)
  9. wrap(Map map)