Package restapi.utils.services.date
Class JodaDateService
java.lang.Object
restapi.utils.services.date.JodaDateService
- All Implemented Interfaces:
DateService
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJodaDateService(org.joda.time.DateTimeZone timeZone) Force system-wide timezone to ensure consistent dates over all servers, independently from the region the server is running. -
Method Summary
Modifier and TypeMethodDescriptionorg.joda.time.DateTimedateFromString(String date) dateToString(org.joda.time.DateTime dateTime) booleanisOlderThan(String dateTime, int min) booleanisOlderThan(org.joda.time.DateTime dateTime, int min) org.joda.time.DateTimenow()
-
Field Details
-
timeZone
private final org.joda.time.DateTimeZone timeZone
-
-
Constructor Details
-
JodaDateService
JodaDateService(org.joda.time.DateTimeZone timeZone) Force system-wide timezone to ensure consistent dates over all servers, independently from the region the server is running.
-
-
Method Details
-
now
public org.joda.time.DateTime now()- Specified by:
nowin interfaceDateService- Returns:
- current date at the moment of the call
-
nowToString
- Specified by:
nowToStringin interfaceDateService- Returns:
- current date at the moment of the call
-
dateToString
- Specified by:
dateToStringin interfaceDateService- Parameters:
dateTime- in DateTime format- Returns:
- dateTime in String format
-
dateFromString
- Specified by:
dateFromStringin interfaceDateService- Parameters:
date- in String format- Returns:
- dateTime in DateTime format
-
isOlderThan
public boolean isOlderThan(org.joda.time.DateTime dateTime, int min) - Specified by:
isOlderThanin interfaceDateService- Parameters:
dateTime- date to compare withmin- minutes that have to have past- Returns:
- if datetime is older than minutes
-
isOlderThan
- Specified by:
isOlderThanin interfaceDateService- Parameters:
dateTime- date to compare with in format Stringmin- minutes that have to have past- Returns:
- if datetime is older than minutes
-