I am getting a parsing exception while I am trying the following code
public class Timezone {
public static void main(String[] args) {
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone tz;
LocalDateTime now = LocalDateTime.now();
final DateTimeFormatter ICS_DATE_FORMATTER =
DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss");
//tz = registry.getTimeZone("Asia/Calcutta");
tz = registry.getTimeZone("Australia/Lord_Howe");
DtStart dtstart;
try {
dtstart = new DtStart(now.format(ICS_DATE_FORMATTER),tz);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
java.text.ParseException: Unparseable date: "20221207T170935"
at java.base/java.text.DateFormat.parse(DateFormat.java:395)
at net.fortuna.ical4j.model.DateTime.setTime(DateTime.java:418)
at net.fortuna.ical4j.model.DateTime.<init>(DateTime.java:325)
at net.fortuna.ical4j.model.property.DateProperty.setValue(DateProperty.java:137)
at net.fortuna.ical4j.model.property.DtStart.<init>(DtStart.java:146)
at Timezone.main(Timezone.java:33)
I have used ical4j 3.0.19 jar and their dependency jar .
Its working for all the timezone except for the timezone "Australia/Lord_Howe".
I am expecting the Dtstart value as :
DTSTART;TZID=Australia/Lord_Howe:20221207T170935