Class Date

java.lang.Object
ch.njol.skript.util.Date
All Implemented Interfaces:
YggdrasilSerializable, Comparable<Date>

public class Date extends Object implements Comparable<Date>, YggdrasilSerializable
  • Constructor Details

    • Date

      public Date()
    • Date

      public Date(long timestamp)
    • Date

      public Date(long timestamp, TimeZone zone)
  • Method Details

    • now

      public static Date now()
      Get a new Date with the current time
      Returns:
      New date with the current time
    • difference

      public Timespan difference(Date other)
    • compareTo

      public int compareTo(@Nullable @Nullable Date other)
      Specified by:
      compareTo in interface Comparable<Date>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTimestamp

      public long getTimestamp()
      Get the timestamp of this date
      Returns:
      The timestamp in milliseconds
    • add

      public void add(Timespan span)
      Add a Timespan to this date
      Parameters:
      span - Timespan to add
    • subtract

      public void subtract(Timespan span)
      Subtract a Timespan from this date
      Parameters:
      span - Timespan to subtract
    • plus

      public Date plus(Timespan span)
      Get a new instance of this Date with the added timespan
      Parameters:
      span - Timespan to add to this Date
      Returns:
      New Date with the added timespan
    • minus

      public Date minus(Timespan span)
      Get a new instance of this Date with the subtracted timespan
      Parameters:
      span - Timespan to subtract from this Date
      Returns:
      New Date with the subtracted timespan
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object