Package io.jans.scim.model.scim2.util
Class DateUtil
java.lang.Object
io.jans.scim.model.scim2.util.DateUtil
Contains helper methods to convert between dates in ISO format and LDAP generalized time syntax.
Examples of ISO-formated dates:
- 2011-12-03T10:15:30
- 2011-12-03T10:15:30.4+01:00
Equivalent dates in generalized time format:
- 20111203101530.000Z
- 20111203111530.400Z
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgeneralizedToISOStringDate(String strDate) Converts a string representing a date (in the LDAP generalized time syntax) to an ISO-8601 formatted string date.static StringgluuCouchbaseISODate(String value) Takes an ISO date and converts to one in UTC+0 time zone (but he timezone suffix/offset is supressed in the result)static StringISOToGeneralizedStringDate(String strDate) Converts a string representation of a date (expected to follow the pattern of DateTime XML schema data type) to a string representation of a date in LDAP generalized time syntax (see RFC 4517 section 3.3.13).static LongISOToMillis(String strDate) static StringmillisToISOString(long millis) Returns a string representation of a date in ISO format based on a number of milliseconds elapsed from "the epoch", namely January 1, 1970, 00:00:00 GMT.
-
Method Details
-
ISOToMillis
-
ISOToGeneralizedStringDate
Converts a string representation of a date (expected to follow the pattern of DateTime XML schema data type) to a string representation of a date in LDAP generalized time syntax (see RFC 4517 section 3.3.13).xsd:dateTimeis equivalent to ISO-8601 format, namely,yyyy-MM-dd'T'HH:mm:ss.SSSZZ- Parameters:
strDate- A string date in ISO format.- Returns:
- A String representing a date in generalized time syntax. If the date passed as parameter did not adhere to xsd:dateTime, the returned value is null
-
generalizedToISOStringDate
Converts a string representing a date (in the LDAP generalized time syntax) to an ISO-8601 formatted string date.- Parameters:
strDate- A string date in generalized time syntax (see RFC 4517 section 3.3.13)- Returns:
- A string representation of a date in ISO format. If the date passed as parameter did not adhere to generalized time syntax, null is returned.
-
millisToISOString
Returns a string representation of a date in ISO format based on a number of milliseconds elapsed from "the epoch", namely January 1, 1970, 00:00:00 GMT.- Parameters:
millis- Number of milliseconds- Returns:
- An ISO-formatted string date
-
gluuCouchbaseISODate
Takes an ISO date and converts to one in UTC+0 time zone (but he timezone suffix/offset is supressed in the result)- Parameters:
value- A string representing a date in ISO-8601, eg 2007-12-03T10:15:30+01:00- Returns:
- A string representing the same input date (eg 2007-12-03T09:15:30)
-