I just found out something strange that I think is a bug.
When I use the constructor method public Date(java.util.Date date) (under the package net.fortuna.ical4j.model), the date created is wrong.
For example, see my code:
String zFEC_FIN = "2012-05-17 00:00:00";
String zFEC_INICIO = "2012-05-17 00:00:00";
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date startDate = formatter.parse(zFEC_INICIO.substring(0, zFEC_INICIO.indexOf(" ")));
java.util.Date finishDate = formatter.parse(zFEC_FIN.substring(0, zFEC_FIN.indexOf(" ")));
System.out.println("java.util.date start: "+startDate + " finish: "+finishDate);
System.out.println("iCal4j start: "+new Date(startDate) + " finish: "+new Date(finishDate));
The screen output is as follows:
java.util.date start: Thu May 17 00:00:00 CEST 2012 finish: Thu May 17 00:00:00 CEST 2012
iCal4j start: 20120516 finish: 20120516
So the constructor is basically substracting one day in the conversion process.
I thought you would want to know :)
Also, I would like to thank you for your effort since the iCal4j library has been very useful to me. Keep up the good work!
Log in to post a comment.