Search in sources :

Example 21 with DtStart

use of net.fortuna.ical4j.model.property.DtStart in project zm-mailbox by Zimbra.

the class TZRule method getDtStart.

/**
 *   From initial TNEF to iCalendar Spec.
 *       The DTSTART property can be hard-coded to 16010101T000000. This is a value that
 *       works well across many calendar client apps.
 *   Note: Some examples seen are similar to this but include the hour of the transition.
 *         Suspect that is useful - so including it.
 *   Zimbra replaces our timezones with closest matchin known ones, so not worth trying
 *   to improve this to see if can choose an accurate start date/time in 1601.
 *
 * @param hr
 * @param min
 * @return
 */
private DtStart getDtStart(int hr, int min) {
    TimeZone utcZone = TimeZone.getTimeZone("UTC");
    GregorianCalendar gc = new GregorianCalendar(1601, 0, /* zero based */
    1, hr, min);
    gc.setTimeZone(utcZone);
    Date startDate = gc.getTime();
    DateTime startDateTime = new DateTime(startDate);
    return new DtStart(startDateTime);
}
Also used : TimeZone(java.util.TimeZone) DtStart(net.fortuna.ical4j.model.property.DtStart) GregorianCalendar(java.util.GregorianCalendar) Date(java.util.Date) DateTime(net.fortuna.ical4j.model.DateTime)

Aggregations

DtStart (net.fortuna.ical4j.model.property.DtStart)21 DateTime (net.fortuna.ical4j.model.DateTime)10 DtEnd (net.fortuna.ical4j.model.property.DtEnd)10 BwDateTime (org.bedework.calfacade.BwDateTime)10 Date (net.fortuna.ical4j.model.Date)9 PropertyList (net.fortuna.ical4j.model.PropertyList)8 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)8 Calendar (net.fortuna.ical4j.model.Calendar)6 Dur (net.fortuna.ical4j.model.Dur)6 VEvent (net.fortuna.ical4j.model.component.VEvent)6 Duration (net.fortuna.ical4j.model.property.Duration)6 ExDate (net.fortuna.ical4j.model.property.ExDate)6 Summary (net.fortuna.ical4j.model.property.Summary)6 Uid (net.fortuna.ical4j.model.property.Uid)6 BwEvent (org.bedework.calfacade.BwEvent)6 TimeZone (net.fortuna.ical4j.model.TimeZone)5 Date (java.util.Date)4 Parameter (net.fortuna.ical4j.model.Parameter)4 Property (net.fortuna.ical4j.model.Property)4 Description (net.fortuna.ical4j.model.property.Description)4