use of net.fortuna.ical4j.model.DateTime in project zm-mailbox by Zimbra.
the class SchedulingViewOfTnef method getDueDate.
/**
* @return the time in UTC that the meeting object was sent or null
* @throws IOException
*/
public DateTime getDueDate() throws IOException {
DateTime timeVal = null;
if (this.getIcalType() != ICALENDAR_TYPE.VTODO) {
return null;
}
timeVal = MapiPropertyId.PidLidTaskDueDate.getDateTimeAsUTC(this);
return timeVal;
}
use of net.fortuna.ical4j.model.DateTime in project zm-mailbox by Zimbra.
the class MapiPropertyId method getDateTimeAsUTC.
/**
* PT_SYSTIME properties wrap FILETIME which is a count of seconds since start of 1601
* Note that some PT_SYSTIME properties are actually stored such that if they are treated
* as UTC times, the day/month/year/hour/min etc components are correct in localtime.
* Calling this method for such properties will result in a DateTime which doesn't reflect
* the underlying real date and time on its own - but this can still be useful.
* @param schedView
* @return DateTime object equivalent to a PT_SYSTIME property where that property
* represents a time in UTC
* @throws IOException
*/
public DateTime getDateTimeAsUTC(SchedulingViewOfTnef schedView) throws IOException {
Date javaDate = getDateValue(schedView);
if (javaDate == null) {
return null;
}
DateTime icalDateTime = new net.fortuna.ical4j.model.DateTime(javaDate);
icalDateTime.setUtc(true);
return icalDateTime;
}
use of net.fortuna.ical4j.model.DateTime 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);
}
use of net.fortuna.ical4j.model.DateTime in project zm-mailbox by Zimbra.
the class IcalUtil method icalUtcTime.
/**
* Use when a UTC equivalent of a DateTime is required with the trailing Z indicating
* that it is UTC
* @param localTimeSince1601
* @param tzDef
* @return
*/
public static String icalUtcTime(long localTimeSince1601, TimeZoneDefinition tzDef) {
DateTime localTime = IcalUtil.localMinsSince1601toDate(localTimeSince1601, tzDef);
SimpleDateFormat utcTimeFmt = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
java.util.TimeZone utcTZ = TimeZone.getTimeZone(TimeZones.UTC_ID);
utcTimeFmt.setTimeZone(utcTZ);
return utcTimeFmt.format(localTime);
}
use of net.fortuna.ical4j.model.DateTime in project zm-mailbox by Zimbra.
the class IcalUtil method friendlyLocalTime.
/**
* Intended for diagnostic purposes.
* @param localTimeSince1601 is the number of minutes since the start of 1601 in <code>tzDef</code>
* @param tzDef
* @return
*/
public static String friendlyLocalTime(long localTimeSince1601, TimeZoneDefinition tzDef) {
DateTime localTime = IcalUtil.localMinsSince1601toDate(localTimeSince1601, tzDef);
SimpleDateFormat localTimeFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
java.util.TimeZone tz;
if (tzDef == null) {
tz = TimeZone.getTimeZone(TimeZones.UTC_ID);
} else {
tz = tzDef.getTimeZone();
}
localTimeFmt.setTimeZone(tz);
return localTimeFmt.format(localTime);
}
Aggregations