Skip to content

Instantly share code, notes, and snippets.

@bmvakili
Created January 28, 2013 16:18
Show Gist options
  • Save bmvakili/4656884 to your computer and use it in GitHub Desktop.
Save bmvakili/4656884 to your computer and use it in GitHub Desktop.
Liferay Calendar - timezones, recurrence, and start/end times
ev0 = Packages.com.liferay.portlet.calendar.service.CalEventLocalServiceUtil.getEvent(66582);
recur0 = Packages.com.liferay.portlet.calendar.service.ICalUtil.toICalRecurrence(ev0.getRecurrenceObj())
dt0 = new Packages.net.fortuna.ical4j.model.Date(ev0.getStartDate());
sc0 = new Packages.net.fortuna.ical4j.model.Date(Packages.java.util.Calendar.getInstance().getTime());
no = recur0.getNextDate( dt0, sc0);
out.println("no: " + no);
///
out.println("-----")
tz = Packages.com.liferay.portal.kernel.util.TimeZoneUtil.getDefault();
ev = Packages.com.liferay.portlet.calendar.service.CalEventLocalServiceUtil.getEvent(66567);
dt = ev.getStartDate();
x = Packages.com.liferay.portal.kernel.util.Time.getDate(dt, tz);
out.println(x + " " + x.getTime());
nc = Packages.java.util.Calendar.getInstance();
nc.setTimeInMillis(dt.getTime());
nc.setTimeZone(tz);
out.println(nc.getTime() + " " + nc.getTime().getTime());
out.println(ev.getStartDate() + " " + ev.getStartDate().getTime() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment