Class SkriptDate
java.lang.Object
io.github.syst3ms.skriptparser.util.SkriptDate
- All Implemented Interfaces:
Comparable<SkriptDate>
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a specific duration to this date.intcompareTo(@Nullable SkriptDate other) difference(SkriptDate other) Returns the duration between the given dates.booleanstatic TimeZonelongSubtracts a specific duration from this date and returns the result of this subtraction.static SkriptDatenow()Creates a newSkriptDateof the current time.static SkriptDateof(long timestamp) Creates a newSkriptDatewith a specific timestamp.static SkriptDateCreates a newSkriptDatewith a specific timestamp.Adds a specific duration to this date and returns the result of this addition.voidSubtracts a specific duration from this date.static SkriptDatetoday()Creates a newSkriptDateof the current date at midnight.static SkriptDateCreates a newSkriptDateof the current date at midnight in a specific time zone.Returns this date as aLocalDate.toString()Returns the string representation of this date using a certain format.
-
Field Details
-
DATE_FORMAT
- See Also:
-
DATE_LOCALE
-
-
Method Details
-
now
-
of
Creates a newSkriptDatewith a specific timestamp. Note that timestamps are expressed in milliseconds. The timestamp is internally stored as a date in the UTC time zone. Use this method if you wish to take a non-default time zone into account.- Parameters:
timestamp- the timestamp- Returns:
- the date
-
of
Creates a newSkriptDatewith a specific timestamp. Note that timestamps are expressed in milliseconds. The zone offset is taken into account when calculating the final timestamp.- Parameters:
timestamp- the timestampzone- the time zone- Returns:
- the date
-
today
Creates a newSkriptDateof the current date at midnight. Note that this takes the default time zone into account. Use this method if you want to use a non-default time zone.- Returns:
- the date
-
today
Creates a newSkriptDateof the current date at midnight in a specific time zone.- Parameters:
zone- the zone- Returns:
- the date
-
getDefaultTimeZone
- Returns:
- the default system time zone
-
getTimestamp
public long getTimestamp()- Returns:
- the amount of milliseconds that have passed since midnight, January 1st, 1970 in the UTC time zone
-
difference
Returns the duration between the given dates.- Parameters:
other- the other date- Returns:
- the duration
-
add
-
subtract
-
plus
Adds a specific duration to this date and returns the result of this addition. A negative duration will subtract instead.- Parameters:
duration- the duration- Returns:
- the date
-
minus
Subtracts a specific duration from this date and returns the result of this subtraction. A negative duration will add instead.- Parameters:
duration- the duration- Returns:
- the date
-
toLocalDateTime
-
compareTo
- Specified by:
compareToin interfaceComparable<SkriptDate>
-
toString
-
toString
-
equals
-