Package at.gv.egovernment.moaspss.util
Class DateTimeUtils
java.lang.Object
at.gv.egovernment.moaspss.util.DateTimeUtils
Utility for parsing and building XML type
dateTime, according to
ISO 8601.- See Also:
-
http://www.w3.org/2001/XMLSchema-datatypes"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilds adateTimevalue from aCalendarvalue.static StringbuildDateTimeUTC(Calendar cal) Builds adateTimevalue in UTC from aCalendarvalue.static StringbuildDateTimeUTC(Date cal) Builds adateTimevalue in UTC from aCalendarvalue.static StringBuilds adateTimevalue from aCalendarvalue.static intCalculates the age if date of birth is given as Calendar objectstatic intCalculates the age if date of birth is given (for a calendar time stamp)static intCalculates the age if date of birth is given as Date objectstatic intCalculates the age if date of birth is given (for a date time stamp)static StringformatPEPSDateToMOADate(String pepsDate) static StringgetDateTimeWithFormat(String format) Returns a date as String using a provided formatstatic DateparseDateTime(String dateTime) Parse aStringcontaining a date and time instant, given in ISO 8601 format.
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
Method Details
-
buildDateTimeUTC
Builds adateTimevalue in UTC from aCalendarvalue.- Parameters:
cal- theCalendarvalue- Returns:
- the
dateTimevalue
-
buildDateTimeUTC
Builds adateTimevalue in UTC from aCalendarvalue.- Parameters:
cal- theCalendarvalue- Returns:
- the
dateTimevalue
-
buildDate
Builds adateTimevalue from aCalendarvalue.- Parameters:
cal- theCalendarvalue- Returns:
- the
dateTimevalue
-
buildTime
Builds adateTimevalue from aCalendarvalue.- Parameters:
cal- theCalendarvalue- Returns:
- the
dateTimevalue
-
parseDateTime
Parse aStringcontaining a date and time instant, given in ISO 8601 format.- Parameters:
dateTime- TheStringto parse.- Returns:
- The
Daterepresentation of the contents ofdateTime. - Throws:
ParseException- Parsing thedateTimefailed.
-
calcAge
Calculates the age if date of birth is given (for a calendar time stamp)- Parameters:
dateOfBirth- Date of Birthnow- Calendar time stamp at which the age needs to be calculated for- Returns:
- Age of a person
-
calcAge
Calculates the age if date of birth is given as Calendar object- Parameters:
dateOfBirth- Date of Birth as Calendar object- Returns:
- Age of a person
-
calcAge
Calculates the age if date of birth is given (for a date time stamp)- Parameters:
dateOfBirth- Date of Birthnow- Date time stamp at which the age needs to be calculated for- Returns:
- Age of a person
-
calcAge
Calculates the age if date of birth is given as Date object- Parameters:
dateOfBirth- Date of Birth as Date object- Returns:
- Age of a person
-
formatPEPSDateToMOADate
-
getDateTimeWithFormat
Returns a date as String using a provided format- Parameters:
format- Format the date/time should be returned- Returns:
- Date/Time as String formatted according the provided format
-