Package ch.njol.skript.util
Class Date
java.lang.Object
java.util.Date
ch.njol.skript.util.Date
- All Implemented Interfaces:
YggdrasilSerializable,Serializable,Cloneable,Comparable<Date>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.njol.yggdrasil.YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aTimespanto this datedifference(Date other) Returns the difference between this date and another date as aTimespan.booleanstatic DatefromJavaDate(Date date) longDeprecated, for removal: This API element is subject to removal in a future version.inthashCode()Get a new instance of this Date with the subtracted timespanstatic Datenow()Get a new Date with the current timeGet a new instance of this Date with the added timespanvoidSubtract aTimespanfrom this datetoString()Methods inherited from class java.util.Date
after, before, clone, compareTo, from, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toInstant, toLocaleString, UTC
-
Constructor Details
-
Date
public Date()Creates a new Date with the current time. -
Date
public Date(long timestamp) Creates a new Date with the provided timestamp.- Parameters:
timestamp- The timestamp in milliseconds.
-
Date
Creates a new Date with the provided timestamp and timezone.- Parameters:
timestamp- The timestamp in milliseconds.zone- The timezone to use.
-
-
Method Details
-
now
Get a new Date with the current time- Returns:
- New date with the current time
-
fromJavaDate
- Parameters:
date- TheDateto convert.- Returns:
- The converted date.
-
add
Add aTimespanto this date- Parameters:
other- Timespan to add
-
subtract
Subtract aTimespanfrom this date- Parameters:
other- Timespan to subtract
-
difference
Returns the difference between this date and another date as aTimespan.- Parameters:
other- The other date.- Returns:
- The difference between the provided dates as a
Timespan.
-
plus
Get a new instance of this Date with the added timespan- Parameters:
other- Timespan to add to this Date- Returns:
- New Date with the added timespan
-
minus
Get a new instance of this Date with the subtracted timespan- Parameters:
other- Timespan to subtract from this Date- Returns:
- New Date with the subtracted timespan
-
getTimestamp
Deprecated, for removal: This API element is subject to removal in a future version.UseDate.getTime()instead. -
hashCode
public int hashCode() -
equals
-
toString
-
Date.getTime()instead.