Package akka.http.javadsl.model
Class DateTime
- java.lang.Object
-
- akka.http.javadsl.model.DateTime
-
- Direct Known Subclasses:
DateTime
public abstract class DateTime extends java.lang.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 DateTime()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract long
clicks()
Returns this instant as "clicks", i.e. as milliseconds since January 1, 1970, 00:00:00 GMTstatic 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.static java.util.Optional<DateTime>
fromIsoDateTimeString(java.lang.String isoDateTimeString)
Returns a new DateTime instance parsed from IsoDateTimeString as Some(dateTime).abstract int
hour()
Returns the hour of this instant in GMT.abstract boolean
isLeapYear()
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
minute()
Returns the minute of this instant in GMT.abstract int
month()
Returns the month of this instant in GMT.abstract java.lang.String
monthStr()
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
second()
Returns the second of this instant in GMT.abstract java.lang.String
toIsoDateString()
Returns a String representation like this: `yyyy-mm-dd`abstract java.lang.String
toIsoDateTimeString()
Returns a String representation like this: `yyyy-mm-ddThh:mm:ss`abstract java.lang.String
toIsoLikeDateTimeString()
Returns a String representation like this: `yyyy-mm-dd hh:mm:ss`abstract java.lang.String
toRfc1123DateTimeString()
Returns an RFC1123 date string, e.g.abstract int
weekday()
Returns the weekday of this instant in GMT.abstract java.lang.String
weekdayStr()
Returns the day of the week as a 3 letter abbreviation: `Sun`, `Mon`, `Tue`, `Wed`, `Thu`, `Fri` or `Sat`abstract int
year()
Returns the year of this instant in GMT.
-
-
-
Method Detail
-
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 java.lang.String weekdayStr()
Returns the day of the week as a 3 letter abbreviation: `Sun`, `Mon`, `Tue`, `Wed`, `Thu`, `Fri` or `Sat`
-
monthStr
public abstract java.lang.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 java.lang.String toIsoDateString()
Returns a String representation like this: `yyyy-mm-dd`
-
toIsoDateTimeString
public abstract java.lang.String toIsoDateTimeString()
Returns a String representation like this: `yyyy-mm-ddThh:mm:ss`
-
toIsoLikeDateTimeString
public abstract java.lang.String toIsoLikeDateTimeString()
Returns a String representation like this: `yyyy-mm-dd hh:mm:ss`
-
toRfc1123DateTimeString
public abstract java.lang.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 java.util.Optional<DateTime> fromIsoDateTimeString(java.lang.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.
-
-