/** Make date time based on the xcal property * * @param val * @return BwDateTime * @throws CalFacadeException */ public static BwDateTime makeBwDateTime(final DateDatetimePropertyType val) throws CalFacadeException { XcalUtil.DtTzid dtTzid = XcalUtil.getDtTzid(val); BwDateTime bwdt = makeBwDateTime(dtTzid.dateOnly, dtTzid.dt, dtTzid.tzid); return bwdt; }
/** Make date time based on the xcal property with tzid supplied * * @param val * @param tzid * @return BwDateTime * @throws CalFacadeException */ public static BwDateTime makeBwDateTime(final DateDatetimePropertyType val, final String tzid) throws CalFacadeException { XcalUtil.DtTzid dtTzid = XcalUtil.getDtTzid(val); BwDateTime bwdt = makeBwDateTime(dtTzid.dateOnly, dtTzid.dt, tzid); return bwdt; }
@Override public ValueComparator convert(final DateDatetimePropertyType val) { XcalUtil.DtTzid dtTzid = XcalUtil.getDtTzid(val); ValueComparator vc = new ValueComparator(); if (dtTzid.dateOnly) { vc.addValue(XcalTags.dateVal, dtTzid.dt); } else { vc.addValue(XcalTags.dateTimeVal, dtTzid.dt); } /* Note we deal with tzid separately as a parameter */ return vc; }
/** For date only values and floating convert to local UTC. For UTC just return * the value. For non-floating convert. * * @param dt * @param tzs * @return string UTC value * @throws Throwable */ public static String getUTC(final DateDatetimePropertyType dt, final TzGetter tzs) throws Throwable { DtTzid dtz = getDtTzid(dt); if ((dtz.dt.length() == 18) && (dtz.dt.charAt(17) == 'Z')) { return dtz.dt; } TimeZone tz = null; if (dtz.tzid != null) { tz = tzs.getTz(dtz.tzid); } DateTime dtim = new DateTime(dtz.dt, tz); dtim.setUtc(true); return dtim.toString(); }
XcalUtil.DtTzid dtTzid = XcalUtil.getDtTzid((DateDatetimePropertyType)prop);