All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.util.Date Maven / Gradle / Ivy

There is a newer version: 0.96-beta4
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy