public class DateEnd extends DateOrDateTimeProperty
Defines the end date of an event or free/busy component.
Code sample (creating):
VEvent event = new VEvent(); //date and time Date datetime = ... DateEnd dtend = new DateEnd(datetime); event.setDateEnd(dtend); //date (without time component) Date date = ... dtend = new DateEnd(date, false); event.setDateEnd(dtend);Code sample (reading):
ICalendar ical = ... for (VEvent event : ical.getEvents()){ DateEnd dtend = event.getDateEnd(); //get property value (ICalDate extends java.util.Date) ICalDate value = dtend.getValue(); if (value.hasTime()){ //the value includes a time component } else { //the value is just a date //date object's time is set to "00:00:00" under local computer's default timezone } //gets the timezone that the property value was parsed under if you are curious about that TimeZone tz = tzinfo.getTimeZone(dtend); }
Code sample (using timezones):
DateEnd dtend = new DateEnd(...); ICalendar ical = new ICalendar(); VEvent event = new VEvent(); event.setDateEnd(dtend); ical.addEvent(event); java.util.TimeZone tz = ... ICalWriter writer = new ICalWriter(...); //set the timezone of all date-time property values //date-time property values are written in UTC by default writer.getTimezoneInfo().setDefaultTimeZone(tz); //set the timezone just for this property writer.getTimezoneInfo().setTimeZone(dtend, tz); //finally, write the iCalendar object writer.write(ical);
value
parameters
Constructor and Description |
---|
DateEnd(Date endDate)
Creates an end date property.
|
DateEnd(Date endDate,
boolean hasTime)
Creates an end date property.
|
DateEnd(ICalDate dateEnd)
Creates an end date property.
|
setValue
getValue, getValue, setValue, validate
addParameter, getParameter, getParameters, getParameters, removeParameter, setParameter, setParameter, setParameters, validate
public DateEnd(Date endDate)
endDate
- the end datepublic DateEnd(Date endDate, boolean hasTime)
endDate
- the end datehasTime
- true if the value has a time component, false if it is
strictly a dateCopyright © 2013-2015 Michael Angstadt. All Rights Reserved.