public class Date extends Iso8601
net.fortuna.ical4j.timezone.date.floating=true
Alternatively you can avoid using the constructor that accepts a java.util.Date object, and instead provide a date
string value. This should always display the correct value, however when the local timezone is used any calculations
(recurrences, etc.) may still be affect by DST rules.
Extract from RFC5545:
3.3.4. Date Value Name: DATE Purpose: This value type is used to identify values that contain a calendar date. Format Definition: This value type is defined by the following notation: date = date-value date-value = date-fullyear date-month date-mday date-fullyear = 4DIGIT date-month = 2DIGIT ;01-12 date-mday = 2DIGIT ;01-28, 01-29, 01-30, 01-31 ;based on month/year Description: If the property permits, multiple "date" values are specified as a COMMA-separated list of values. The format for the value type is based on the [ISO.8601.2004] complete representation, basic format for a calendar date. The textual format specifies a four-digit year, two-digit month, and two-digit day of the month. There are no separator characters between the year, month, and day component text. No additional content value encoding (i.e., BACKSLASH character encoding, see Section 3.3.11) is defined for this value type. Example: The following represents July 14, 1997: 19970714
Modifier | Constructor and Description |
---|---|
|
Date()
Default constructor.
|
|
Date(java.util.Calendar calendar) |
|
Date(java.util.Date date) |
protected |
Date(int precision,
java.util.TimeZone tz)
Creates a new date instance with the specified precision.
|
|
Date(long time) |
protected |
Date(long time,
int precision,
java.util.TimeZone tz)
Creates a new date instance with the specified precision.
|
|
Date(java.lang.String value) |
|
Date(java.lang.String value,
java.lang.String pattern) |
after, before, clone, compareTo, equals, from, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setYear, toGMTString, toInstant, toLocaleString, UTC
public Date()
protected Date(int precision, java.util.TimeZone tz)
precision
- the date precisiontz
- the timezoneDates.PRECISION_DAY
,
Dates.PRECISION_SECOND
public Date(long time)
time
- a date value in millisecondsprotected Date(long time, int precision, java.util.TimeZone tz)
time
- a date value in millisecondsprecision
- the date precisiontz
- the timezoneDates.PRECISION_DAY
,
Dates.PRECISION_SECOND
public Date(java.util.Calendar calendar)
calendar
- a calendar valuepublic Date(java.util.Date date)
date
- a date valuepublic Date(java.lang.String value) throws java.text.ParseException
value
- a string representation of a datejava.text.ParseException
- where the specified string is not a valid datepublic Date(java.lang.String value, java.lang.String pattern) throws java.text.ParseException
value
- a string representation of a datepattern
- a date pattern to apply when parsingjava.text.ParseException
- where the specified string is not a valid date