use of uk.nhs.adaptors.oneoneone.cda.report.enums.DateFormat in project integration-adaptor-111 by nhsconnect.
the class DateUtil method parse.
public static DateTimeType parse(String dateToParse) {
DateFormat format = getFormat(dateToParse);
SimpleDateFormat formatter = getFormatter(format);
try {
Date date = formatter.parse(dateToParse);
return new DateTimeType(date, format.getPrecision(), TimeZone.getTimeZone(ZoneOffset.UTC));
} catch (ParseException e) {
throw new IllegalStateException(String.format(ERROR_MESSAGE, dateToParse), e);
}
}
use of uk.nhs.adaptors.oneoneone.cda.report.enums.DateFormat in project integration-adaptor-111 by nhsconnect.
the class DateUtil method parseToInstantType.
public static InstantType parseToInstantType(String dateToParse) {
DateFormat format = getFormat(dateToParse);
SimpleDateFormat formatter = getFormatter(format);
try {
Date date = formatter.parse(dateToParse);
return new InstantType(date, TemporalPrecisionEnum.MILLI, TimeZone.getTimeZone(ZoneOffset.UTC));
} catch (ParseException e) {
throw new IllegalStateException(String.format(ERROR_MESSAGE, dateToParse), e);
}
}
Aggregations