Class DateTime

java.lang.Object
akka.http.javadsl.model.DateTime
Direct Known Subclasses:
DateTime

public abstract class DateTime extends Object
Immutable, fast and efficient Date + Time implementation without any dependencies. Does not support TimeZones, all DateTime values are always GMT based. Note that this implementation discards milliseconds (i.e. rounds down to full seconds).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract long
    Returns this instant as "clicks", i.e. as milliseconds since January 1, 1970, 00:00:00 GMT
    static DateTime
    create(int year, int month, int day, int hour, int minute, int second)
    Returns a new DateTime instance by interpreting the given date/time components as an instant in GMT.
    static DateTime
    create(long clicks)
    Returns a new DateTime instance representing the instant as defined by "clicks" i.e. from the number of milliseconds since the start of "the epoch", namely January 1, 1970, 00:00:00 GMT.
    abstract int
    day()
    Returns the day of this instant in GMT.
    fromIsoDateTimeString(String isoDateTimeString)
    Returns a new DateTime instance parsed from IsoDateTimeString as Some(dateTime).
    abstract int
    Returns the hour of this instant in GMT.
    abstract boolean
    Returns if this instant interpreted as a Date in GMT belongs to a leap year.
    abstract DateTime
    minus(long millis)
    Creates a new `DateTime` that represents the point in time the given number of ms earlier.
    abstract int
    Returns the minute of this instant in GMT.
    abstract int
    Returns the month of this instant in GMT.
    abstract String
    Returns the month as a 3 letter abbreviation: `Jan`, `Feb`, `Mar`, `Apr`, `May`, `Jun`, `Jul`, `Aug`, `Sep`, `Oct`, `Nov` or `Dec`
    static DateTime
    now()
    Returns a new DateTime instance representing the current instant.
    abstract DateTime
    plus(long millis)
    Creates a new `DateTime` that represents the point in time the given number of ms later.
    abstract int
    Returns the second of this instant in GMT.
    abstract String
    Returns a String representation like this: `yyyy-mm-dd`
    abstract String
    Returns a String representation like this: `yyyy-mm-ddThh:mm:ss`
    abstract String
    Returns a String representation like this: `yyyy-mm-dd hh:mm:ss`
    abstract String
    Returns an RFC1123 date string, e.g.
    abstract int
    Returns the weekday of this instant in GMT.
    abstract String
    Returns the day of the week as a 3 letter abbreviation: `Sun`, `Mon`, `Tue`, `Wed`, `Thu`, `Fri` or `Sat`
    abstract int
    Returns the year of this instant in GMT.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DateTime

      public DateTime()
  • Method Details

    • year

      public abstract int year()
      Returns the year of this instant in GMT.
    • month

      public abstract int month()
      Returns the month of this instant in GMT.
    • day

      public abstract int day()
      Returns the day of this instant in GMT.
    • hour

      public abstract int hour()
      Returns the hour of this instant in GMT.
    • minute

      public abstract int minute()
      Returns the minute of this instant in GMT.
    • second

      public abstract int second()
      Returns the second of this instant in GMT.
    • weekday

      public abstract int weekday()
      Returns the weekday of this instant in GMT. Sunday is 0, Monday is 1, etc.
    • clicks

      public abstract long clicks()
      Returns this instant as "clicks", i.e. as milliseconds since January 1, 1970, 00:00:00 GMT
    • isLeapYear

      public abstract boolean isLeapYear()
      Returns if this instant interpreted as a Date in GMT belongs to a leap year.
    • weekdayStr

      public abstract String weekdayStr()
      Returns the day of the week as a 3 letter abbreviation: `Sun`, `Mon`, `Tue`, `Wed`, `Thu`, `Fri` or `Sat`
    • monthStr

      public abstract String monthStr()
      Returns the month as a 3 letter abbreviation: `Jan`, `Feb`, `Mar`, `Apr`, `May`, `Jun`, `Jul`, `Aug`, `Sep`, `Oct`, `Nov` or `Dec`
    • toIsoDateString

      public abstract String toIsoDateString()
      Returns a String representation like this: `yyyy-mm-dd`
    • toIsoDateTimeString

      public abstract String toIsoDateTimeString()
      Returns a String representation like this: `yyyy-mm-ddThh:mm:ss`
    • toIsoLikeDateTimeString

      public abstract String toIsoLikeDateTimeString()
      Returns a String representation like this: `yyyy-mm-dd hh:mm:ss`
    • toRfc1123DateTimeString

      public abstract String toRfc1123DateTimeString()
      Returns an RFC1123 date string, e.g. `Sun, 06 Nov 1994 08:49:37 GMT`
    • now

      public static DateTime now()
      Returns a new DateTime instance representing the current instant.
    • minus

      public abstract DateTime minus(long millis)
      Creates a new `DateTime` that represents the point in time the given number of ms earlier.
    • plus

      public abstract DateTime plus(long millis)
      Creates a new `DateTime` that represents the point in time the given number of ms later.
    • fromIsoDateTimeString

      public static Optional<DateTime> fromIsoDateTimeString(String isoDateTimeString)
      Returns a new DateTime instance parsed from IsoDateTimeString as Some(dateTime). Returns None if parsing has failed.
    • create

      public static DateTime create(long clicks)
      Returns a new DateTime instance representing the instant as defined by "clicks" i.e. from the number of milliseconds since the start of "the epoch", namely January 1, 1970, 00:00:00 GMT. Note that this implementation discards milliseconds (i.e. rounds down to full seconds).
    • create

      public static DateTime create(int year, int month, int day, int hour, int minute, int second)
      Returns a new DateTime instance by interpreting the given date/time components as an instant in GMT.