Java tutorial
//package com.java2s; import java.util.*; public class Main { /** * Oftentimes all-day events have messed up starting times, which can cause * them to be displayed before events that happen in the previous day. * * The times are usually off by the Timezone offset, so we should be able * to just subtract the offset from the given event time, and it should be * all fixed. * * @param eventStart * @param eventEnd * The date to modify */ private static void fixAllDayEvent(GregorianCalendar eventStart, GregorianCalendar eventEnd) { long milliseconds = eventStart.getTimeInMillis(); milliseconds -= eventStart.getTimeZone().getRawOffset(); eventStart.setTimeInMillis(milliseconds); milliseconds = eventEnd.getTimeInMillis(); milliseconds -= eventEnd.getTimeZone().getRawOffset(); eventEnd.setTimeInMillis(milliseconds - 1000); } }