java.util.Date Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dragome-js-jre Show documentation
Show all versions of dragome-js-jre Show documentation
Dragome SDK module: js-jre
package java.util;
import com.dragome.commons.javascript.ScriptHelper;
public class Date
{
private Object nativeDate;
public Date()
{
ScriptHelper.eval("this.nativeDate = new Date()", this);
}
public Date(long millis)
{
ScriptHelper.put("millis", millis, this);
ScriptHelper.eval("this.nativeDate = new Date(millis)", this);
}
public long getTime()
{
return ScriptHelper.evalLong("this.nativeDate.getTime()");
}
public void setTime(long millis)
{
ScriptHelper.put("millis", millis, this);
ScriptHelper.eval("this.nativeDate.setTime(millis)", this);
}
public boolean equals(Object obj)
{
Date other= (Date) obj;
return getTime() == other.getTime();
}
public int hashCode()
{
long time= getTime();
return (int) (time ^ (time >>> 32));
}
public String toString()
{
return (String) ScriptHelper.eval("this.nativeDate.toGMTString()", this);
}
}