本文整理了Java中net.fortuna.ical4j.model.Date.<init>()
方法的一些代码示例,展示了Date.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Date.<init>()
方法的具体详情如下:
包路径:net.fortuna.ical4j.model.Date
类名称:Date
方法名:<init>
[英]Default constructor.
[中]默认构造函数。
代码示例来源:origin: PrivacyApps/calendar-import-export
private Date utcDateFromMs(long ms) {
// This date will be UTC provided the default false value of the iCal4j property
// "net.fortuna.ical4j.timezone.date.floating" has not been changed.
return new Date(ms);
}
代码示例来源:origin: micromata/projectforge
public static net.fortuna.ical4j.model.Date parseICal4jDate(final String dateString)
{
if (dateString == null) {
return null;
}
net.fortuna.ical4j.model.Date date;
try {
date = new net.fortuna.ical4j.model.Date(dateString);
} catch (final ParseException ex) {
log.error("Unable to parse date string: '" + dateString + "': " + ex.getMessage(), ex);
return null;
}
return date;
}
代码示例来源:origin: ical4j/ical4j
/**
* Returns a new date instance of the specified type. If no type is
* specified a DateTime instance is returned.
* @param date a seed Java date instance
* @param type the type of date instance
* @return an instance of <code>net.fortuna.ical4j.model.Date</code>
*/
public static Date getInstance(final java.util.Date date, final Value type) {
if (Value.DATE.equals(type)) {
return new Date(date);
}
return new DateTime(date);
}
代码示例来源:origin: org.bedework/bw-ical4j-cl
/**
* Returns a new date instance of the specified type. If no type is
* specified a DateTime instance is returned.
* @param date a seed Java date instance
* @param type the type of date instance
* @return an instance of <code>net.fortuna.ical4j.model.Date</code>
*/
public static Date getInstance(final java.util.Date date, final Value type) {
if (Value.DATE.equals(type)) {
return new Date(date);
}
return new DateTime(date);
}
代码示例来源:origin: net.oneandone.ical4j/ical4j
/**
* Returns a new date instance of the specified type. If no type is
* specified a DateTime instance is returned.
* @param date a seed Java date instance
* @param type the type of date instance
* @return an instance of <code>net.fortuna.ical4j.model.Date</code>
*/
public static Date getInstance(final java.util.Date date, final Value type) {
if (Value.DATE.equals(type)) {
return new Date(date);
}
return new DateTime(date);
}
代码示例来源:origin: org.bedework.ical4j/ical4j
/**
* Returns a new date instance of the specified type. If no type is
* specified a DateTime instance is returned.
* @param date a seed Java date instance
* @param type the type of date instance
* @return an instance of <code>net.fortuna.ical4j.model.Date</code>
*/
public static Date getInstance(final java.util.Date date, final Value type) {
if (Value.DATE.equals(type)) {
return new Date(date);
}
return new DateTime(date);
}
代码示例来源:origin: org.mnode.ical4j/ical4j
/**
* Returns a new date instance of the specified type. If no type is
* specified a DateTime instance is returned.
* @param date a seed Java date instance
* @param type the type of date instance
* @return an instance of <code>net.fortuna.ical4j.model.Date</code>
*/
public static Date getInstance(final java.util.Date date, final Value type) {
if (Value.DATE.equals(type)) {
return new Date(date);
}
return new DateTime(date);
}
代码示例来源:origin: miltonio/milton2
@Override
void mapToCard(net.fortuna.ical4j.model.Calendar cal, Object bean, PropertyDescriptor pd) {
VEvent vevent = event(cal);
Date d = propertyAccessor.get(bean, pd.getReadMethod(), Date.class);
if (d == null) {
return;
}
net.fortuna.ical4j.model.Date dt = new net.fortuna.ical4j.model.Date(d);
net.fortuna.ical4j.model.property.DtEnd p = new net.fortuna.ical4j.model.property.DtEnd(dt);
vevent.getProperties().add(p);
}
}
代码示例来源:origin: miltonio/milton2
@Override
void mapToCard(net.fortuna.ical4j.model.Calendar cal, Object bean, PropertyDescriptor pd) {
VEvent vevent = event(cal);
Date d = propertyAccessor.get(bean, pd.getReadMethod(), Date.class);
if (d == null) {
return;
}
net.fortuna.ical4j.model.Date dt = new net.fortuna.ical4j.model.Date(d);
net.fortuna.ical4j.model.property.DtStart p = new net.fortuna.ical4j.model.property.DtStart(dt);
vevent.getProperties().add(p);
}
}
代码示例来源:origin: ical4j/ical4j
private void getDates(java.util.Date startRange, java.util.Date endRange, java.util.Date eventStart, Recur recur) {
net.fortuna.ical4j.model.Date start = new net.fortuna.ical4j.model.Date(startRange);
net.fortuna.ical4j.model.Date end = new net.fortuna.ical4j.model.Date(endRange);
net.fortuna.ical4j.model.Date seed = new net.fortuna.ical4j.model.Date(eventStart);
DateList dates = recur.getDates(seed, start, end, Value.DATE);
for (int i=0; i<dates.size(); i++) {
log.info("date_" + i + " = " + dates.get(i).toString());
}
}
代码示例来源:origin: ical4j/ical4j
/**
* Test method for {@link net.fortuna.ical4j.model.component.Observance#getLatestOnset(net.fortuna.ical4j.model.Date)}.
*/
public void testGetLatestOnset() {
for (int i = 10; i > 0; i--) {
Calendar cal = Calendar.getInstance();
cal.set(2000 + i, i, i);
Date onset = observance.getLatestOnset(new Date(cal.getTime()));
assertNotNull(onset);
}
}
代码示例来源:origin: ical4j/ical4j
/**
* A test to confirm that the end date is calculated correctly
* from a given start date and duration.
*/
public final void testEventEndDate() {
Calendar cal = getCalendarInstance();
Date startDate = new Date(cal.getTime());
log.info("Start date: " + startDate);
VEvent event = new VEvent(startDate,
java.time.Duration.ofDays(3), "3 day event");
Date endDate = event.getEndDate().getDate();
log.info("End date: " + endDate);
cal.add(Calendar.DAY_OF_YEAR, 3);
assertEquals(new Date(cal.getTime()), endDate);
}
代码示例来源:origin: ical4j/ical4j
public final void test2() {
java.util.Calendar cal = getCalendarInstance();
cal.set(java.util.Calendar.MONTH, java.util.Calendar.DECEMBER);
cal.set(java.util.Calendar.DAY_OF_MONTH, 25);
VEvent christmas = new VEvent(new Date(cal.getTime()), "Christmas Day");
// initialise as an all-day event..
christmas.getProperty(Property.DTSTART).getParameters().add(Value.DATE);
// add timezone information..
christmas.getProperty(Property.DTSTART).getParameters().add(tzParam);
log.info(christmas.toString());
}
代码示例来源:origin: micromata/projectforge
@Override
public Property toVEvent(final TeamEventDO event)
{
if (event.isAllDay() == true) {
final Date startUtc = CalendarUtils.getUTCMidnightDate(event.getStartDate());
net.fortuna.ical4j.model.Date date = new net.fortuna.ical4j.model.Date(startUtc);
return new DtStart(date);
} else {
DateTime date = new DateTime(event.getStartDate());
date.setTimeZone(TIMEZONE_REGISTRY.getTimeZone(event.getTimeZone().getID()));
return new DtStart(date);
}
}
代码示例来源:origin: ical4j/ical4j
public final void testGetConsumedTime3() throws Exception {
String resource = "/samples/valid/calconnect10.ics";
net.fortuna.ical4j.model.Calendar calendar = loadCalendar(resource);
VEvent vev = (VEvent) calendar.getComponent(Component.VEVENT);
Date start = vev.getStartDate().getDate();
Calendar cal = getCalendarInstance();
cal.add(Calendar.YEAR, 1);
Date latest = new Date(cal.getTime());
PeriodList pl = vev.getConsumedTime(start, latest);
assertTrue(!pl.isEmpty());
}
代码示例来源:origin: net.oneandone.cosmo/cosmo-core
/**
* Sets base content attributes.
* @param item The content item.
*/
private void setBaseContentAttributes(ContentItem item) {
TriageStatus ts = entityFactory.createTriageStatus();
TriageStatusUtil.initialize(ts);
item.setClientCreationDate(new Date());
item.setClientModifiedDate(item.getClientCreationDate());
item.setTriageStatus(ts);
item.setLastModification(ContentItem.Action.CREATED);
item.setSent(Boolean.FALSE);
item.setNeedsReply(Boolean.FALSE);
}
代码示例来源:origin: 1and1/cosmo
/**
* Sets base content attributes.
* @param item The content item.
*/
private void setBaseContentAttributes(ContentItem item) {
TriageStatus ts = entityFactory.createTriageStatus();
TriageStatusUtil.initialize(ts);
item.setClientCreationDate(new Date());
item.setClientModifiedDate(item.getClientCreationDate());
item.setTriageStatus(ts);
item.setLastModification(ContentItem.Action.CREATED);
item.setSent(Boolean.FALSE);
item.setNeedsReply(Boolean.FALSE);
}
代码示例来源:origin: ical4j/ical4j
/**
* @return
* @throws ParseException
*/
public static TestSuite suite() throws ParseException {
TestSuite suite = new TestSuite();
suite.addTest(new DateListTest(new DateList(), 0));
suite.addTest(new DateListTest(new Date().toString(), Value.DATE, 1));
suite.addTest(new DateListTest(new DateTime().toString(), Value.DATE_TIME, 1));
suite.addTest(new DateListTest(new DateTime(123).toString() + "," + new DateTime(999).toString(), Value.DATE_TIME, 2));
return suite;
}
}
代码示例来源:origin: ical4j/ical4j
/**
* Unit tests for timezone constructor.
*/
public void testDtStartTimezone() throws ParseException {
DtStart dtStart = new DtStart(timezone);
dtStart.setValue(new DateTime().toString());
assertEquals(timezone, dtStart.getTimeZone());
// initialising with DATE value should reset timezone..
dtStart.setDate(new Date());
assertNull(dtStart.getTimeZone());
}
代码示例来源:origin: ical4j/ical4j
/**
* Test equality of events with different alarm sub-components.
*/
public void testEquals() {
Date date = new Date();
String summary = "test event";
PropertyList props = new PropertyList();
props.add(new DtStart(date));
props.add(new Summary(summary));
VEvent e1 = new VEvent(props);
VEvent e2 = new VEvent(props);
assertTrue(e1.equals(e2));
e2.getAlarms().add(new VAlarm());
assertFalse(e1.equals(e2));
}
内容来源于网络,如有侵权,请联系作者删除!