In one of the HL7 date time values, I get values like 202009010935-0400 I am trying to use joda time to parse that and convert into a yyyy-MM-dd'T'HH:mm:ss format. Using this line of code
var instant = org.joda.time.format.DateTimeFormat.forPattern('yyyyMMddHHmm-ZZZZ').parseMillis(new String(date));
var value = org.joda.time.format.DateTimeFormat.forPattern(yyyy-MM-dd'T'HH:mm:ss).print(instant);
throws an exception
JavaException: java.lang.IllegalArgumentException: Invalid format: "202009010935-0400" is malformed at "-0400"
Since I have no control over the data value sent, what's the correct format to use in this case?
I have tried using yyyyMMddHHmm-HHmm but that simply converts the date to 2020-09-01T04:00