Package akka.http.javadsl.model
Class DateTime
java.lang.Object
akka.http.javadsl.model.DateTime
- Direct Known Subclasses:
DateTime
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
-
Method Summary
Modifier and TypeMethodDescriptionabstract 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.fromIsoDateTimeString
(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
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 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 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
weekday()
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
year()
Returns the year of this instant in GMT.
-
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
Returns the day of the week as a 3 letter abbreviation: `Sun`, `Mon`, `Tue`, `Wed`, `Thu`, `Fri` or `Sat` -
monthStr
Returns the month as a 3 letter abbreviation: `Jan`, `Feb`, `Mar`, `Apr`, `May`, `Jun`, `Jul`, `Aug`, `Sep`, `Oct`, `Nov` or `Dec` -
toIsoDateString
Returns a String representation like this: `yyyy-mm-dd` -
toIsoDateTimeString
Returns a String representation like this: `yyyy-mm-ddThh:mm:ss` -
toIsoLikeDateTimeString
Returns a String representation like this: `yyyy-mm-dd hh:mm:ss` -
toRfc1123DateTimeString
Returns an RFC1123 date string, e.g. `Sun, 06 Nov 1994 08:49:37 GMT` -
now
Returns a new DateTime instance representing the current instant. -
minus
Creates a new `DateTime` that represents the point in time the given number of ms earlier. -
plus
Creates a new `DateTime` that represents the point in time the given number of ms later. -
fromIsoDateTimeString
Returns a new DateTime instance parsed from IsoDateTimeString as Some(dateTime). Returns None if parsing has failed. -
create
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
Returns a new DateTime instance by interpreting the given date/time components as an instant in GMT.
-