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.DateTime
dateFromString
(String date) dateToString
(org.joda.time.DateTime dateTime) boolean
isOlderThan
(String dateTime, int min) boolean
isOlderThan
(org.joda.time.DateTime dateTime, int min) org.joda.time.DateTime
now()
-
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:
now
in interfaceDateService
- Returns:
- current date at the moment of the call
-
nowToString
- Specified by:
nowToString
in interfaceDateService
- Returns:
- current date at the moment of the call
-
dateToString
- Specified by:
dateToString
in interfaceDateService
- Parameters:
dateTime
- in DateTime format- Returns:
- dateTime in String format
-
dateFromString
- Specified by:
dateFromString
in interfaceDateService
- Parameters:
date
- in String format- Returns:
- dateTime in DateTime format
-
isOlderThan
public boolean isOlderThan(org.joda.time.DateTime dateTime, int min) - Specified by:
isOlderThan
in interfaceDateService
- Parameters:
dateTime
- date to compare withmin
- minutes that have to have past- Returns:
- if datetime is older than minutes
-
isOlderThan
- Specified by:
isOlderThan
in interfaceDateService
- Parameters:
dateTime
- date to compare with in format Stringmin
- minutes that have to have past- Returns:
- if datetime is older than minutes
-