Class DateTime
java.lang.Object
org.apache.pekko.http.javadsl.model.DateTime
org.apache.pekko.http.scaladsl.model.DateTime
- All Implemented Interfaces:
- Serializable,- Comparable<DateTime>,- Renderable,- scala.Equals,- scala.math.Ordered<DateTime>,- scala.Product
public final class DateTime
extends DateTime
implements scala.math.Ordered<DateTime>, Renderable, scala.Product, Serializable
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).
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic DateTimeapply(int year, int month, int day, int hour, int minute, int second) Creates a newDateTimewith the given properties.static DateTimeapply(long clicks) Creates a newDateTimefrom the number of milli seconds since the start of "the epoch", namely January 1, 1970, 00:00:00 GMT.longclicks()Returns this instant as "clicks", i.e. as milliseconds since January 1, 1970, 00:00:00 GMTintintday()Returns the day of this instant in GMT.booleanstatic scala.Option<DateTime>fromIsoDateTimeString(String string) Creates a new DateTime instance from the given String, if it adheres to the formatyyyy-mm-ddThh:mm:ss[.SSSZ].inthashCode()inthour()Returns the hour of this instant in GMT.booleanReturns if this instant interpreted as a Date in GMT belongs to a leap year.static DateTimeMaxValue()minus(long millis) Creates a newDateTimethat represents the point in time the given number of ms earlier.intminute()Returns the minute of this instant in GMT.static DateTimeMinValue()intmonth()Returns the month of this instant in GMT.monthStr()The month as a 3 letter abbreviation:Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,NovorDecstatic DateTimenow()Creates a newDateTimeinstance for the current point in time.plus(long millis) Creates a newDateTimethat represents the point in time the given number of ms later.render(R r) yyyy-mm-ddThh:mm:ssrenderIsoDate(R r) yyyy-mm-ddyyyy-mm-ddThh:mm:ssyyyy-mm-dd hh:mm:ssRFC1123 date string, e.g.intsecond()Returns the second of this instant in GMT.yyyy-mm-ddyyyy-mm-ddThh:mm:ssyyyy-mm-dd hh:mm:ssRFC1123 date string, e.g.toString()yyyy-mm-ddThh:mm:ssintweekday()Returns the weekday of this instant in GMT.The day of the week as a 3 letter abbreviation:Sun,Mon,Tue,Wed,Thu,FriorSatintyear()Returns the year of this instant in GMT.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface scala.EqualscanEqualMethods inherited from interface scala.math.Ordered$greater, $greater$eq, $less, $less$eq, compareToMethods inherited from interface scala.ProductproductArity, productElement, productElementName, productElementNames, productIterator, productPrefix
- 
Constructor Details- 
DateTimepublic DateTime()
 
- 
- 
Method Details- 
MinValue
- 
MaxValue
- 
applyCreates a newDateTimewith the given properties. Note that this implementation discards milliseconds (i.e. rounds down to full seconds).- Parameters:
- year- (undocumented)
- month- (undocumented)
- day- (undocumented)
- hour- (undocumented)
- minute- (undocumented)
- second- (undocumented)
- Returns:
- (undocumented)
 
- 
applyCreates a newDateTimefrom the number of milli seconds 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).- Parameters:
- clicks- (undocumented)
- Returns:
- (undocumented)
 
- 
nowCreates a newDateTimeinstance for the current point in time. Note that this implementation discards milliseconds (i.e. rounds down to full seconds).- Returns:
- (undocumented)
 
- 
fromIsoDateTimeStringCreates a new DateTime instance from the given String, if it adheres to the formatyyyy-mm-ddThh:mm:ss[.SSSZ]. Note that this implementation discards milliseconds (i.e. rounds down to full seconds).- Parameters:
- string- (undocumented)
- Returns:
- (undocumented)
 
- 
yearpublic int year()Description copied from class:DateTimeReturns the year of this instant in GMT.
- 
monthpublic int month()Description copied from class:DateTimeReturns the month of this instant in GMT.
- 
daypublic int day()Description copied from class:DateTimeReturns the day of this instant in GMT.
- 
hourpublic int hour()Description copied from class:DateTimeReturns the hour of this instant in GMT.
- 
minutepublic int minute()Description copied from class:DateTimeReturns the minute of this instant in GMT.
- 
secondpublic int second()Description copied from class:DateTimeReturns the second of this instant in GMT.
- 
weekdaypublic int weekday()Description copied from class:DateTimeReturns the weekday of this instant in GMT. Sunday is 0, Monday is 1, etc.
- 
clickspublic long clicks()Description copied from class:DateTimeReturns this instant as "clicks", i.e. as milliseconds since January 1, 1970, 00:00:00 GMT
- 
isLeapYearpublic boolean isLeapYear()Description copied from class:DateTimeReturns if this instant interpreted as a Date in GMT belongs to a leap year.- Specified by:
- isLeapYearin class- DateTime
 
- 
weekdayStrThe day of the week as a 3 letter abbreviation:Sun,Mon,Tue,Wed,Thu,FriorSat- Specified by:
- weekdayStrin class- DateTime
- Returns:
- (undocumented)
 
- 
monthStrThe month as a 3 letter abbreviation:Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,NovorDec
- 
minusCreates a newDateTimethat represents the point in time the given number of ms earlier.
- 
plusCreates a newDateTimethat represents the point in time the given number of ms later.
- 
renderyyyy-mm-ddThh:mm:ss- Specified by:
- renderin interface- Renderable
- Parameters:
- r- (undocumented)
- Returns:
- (undocumented)
 
- 
toStringyyyy-mm-ddThh:mm:ss
- 
renderIsoDateyyyy-mm-dd- Parameters:
- r- (undocumented)
- Returns:
- (undocumented)
 
- 
toIsoDateStringyyyy-mm-dd- Specified by:
- toIsoDateStringin class- DateTime
- Returns:
- (undocumented)
 
- 
renderIsoDateTimeStringyyyy-mm-ddThh:mm:ss- Parameters:
- r- (undocumented)
- Returns:
- (undocumented)
 
- 
toIsoDateTimeStringyyyy-mm-ddThh:mm:ss- Specified by:
- toIsoDateTimeStringin class- DateTime
- Returns:
- (undocumented)
 
- 
renderIsoLikeDateTimeStringyyyy-mm-dd hh:mm:ss- Parameters:
- r- (undocumented)
- Returns:
- (undocumented)
 
- 
toIsoLikeDateTimeStringyyyy-mm-dd hh:mm:ss- Specified by:
- toIsoLikeDateTimeStringin class- DateTime
- Returns:
- (undocumented)
 
- 
renderRfc1123DateTimeStringRFC1123 date string, e.g.Sun, 06 Nov 1994 08:49:37 GMT- Parameters:
- r- (undocumented)
- Returns:
- (undocumented)
 
- 
toRfc1123DateTimeStringRFC1123 date string, e.g.Sun, 06 Nov 1994 08:49:37 GMT- Specified by:
- toRfc1123DateTimeStringin class- DateTime
- Returns:
- (undocumented)
 
- 
compare- Specified by:
- comparein interface- scala.math.Ordered<DateTime>
 
- 
hashCodepublic int hashCode()
- 
equals
 
-