This constructor uses the Calendar class to remove the time components from the specified date. The Calendar object returned from Calendar.getInstance defaults to using the default timezone for the device (machine). This causes the resulting date to be offset by the default timezone’s offset from UTC. As an example:
I want to create an all day event with a start date of 9/24/2015 and end date of 9/25/2015. I pass in a date object for 9/24/2015 00:00:00, and 9/25/2015 00:00:00 (obviously UTC, since all Dates are UTC). My timezone is CDT (UTC-5:00). What happens is, the Calendar object has a time of 9/23/2015 19:00:00, because it’s in CDT time, and I end up with a date of 9/23/2015 with the time components removed.
This should be a simple matter of adding the line: c.setTimeZone(TimeZone.getTimeZone("UTC”));
From thread: https://sourceforge.net/p/biweekly/discussion/help-and-support/thread/0540a0b1/?limit=25#e251
This constructor uses the Calendar class to remove the time components from the specified date. The Calendar object returned from Calendar.getInstance defaults to using the default timezone for the device (machine). This causes the resulting date to be offset by the default timezone’s offset from UTC. As an example:
I want to create an all day event with a start date of 9/24/2015 and end date of 9/25/2015. I pass in a date object for 9/24/2015 00:00:00, and 9/25/2015 00:00:00 (obviously UTC, since all Dates are UTC). My timezone is CDT (UTC-5:00). What happens is, the Calendar object has a time of 9/23/2015 19:00:00, because it’s in CDT time, and I end up with a date of 9/23/2015 with the time components removed. This should be a simple matter of adding the line: c.setTimeZone(TimeZone.getTimeZone("UTC”));
Reported by: mangstadt
Original Ticket: biweekly/tickets/13