net.fortuna.ical4j.model.DateTime.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中net.fortuna.ical4j.model.DateTime.<init>()方法的一些代码示例,展示了DateTime.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.<init>()方法的具体详情如下:
包路径:net.fortuna.ical4j.model.DateTime
类名称:DateTime
方法名:<init>

DateTime.<init>介绍

[英]Default constructor.
[中]默认构造函数。

代码示例

代码示例来源:origin: traccar/traccar

public boolean checkMoment(Date date) {
  if (calendar != null) {
    Period period = new Period(new DateTime(date), new Dur(0, 0, 0, 0));
    Predicate<CalendarComponent> periodRule = new PeriodRule<>(period);
    Filter<CalendarComponent> filter = new Filter<>(new Predicate[] {periodRule}, Filter.MATCH_ANY);
    Collection<CalendarComponent> events = filter.filter(calendar.getComponents(CalendarComponent.VEVENT));
    if (events != null && !events.isEmpty()) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: ical4j/ical4j

/**
 * @param name       a property name
 * @param parameters list of parameters
 */
public UtcProperty(final String name, final ParameterList parameters, PropertyFactory factory) {
  super(name, parameters, factory);
  setDate(new DateTime(true));
}

代码示例来源:origin: ical4j/ical4j

/**
 * @param name a property name
 */
public UtcProperty(final String name, PropertyFactory factory) {
  super(name, factory);
  setDate(new DateTime(true));
}

代码示例来源:origin: org.mnode.ical4j/ical4j

/**
 * @param name a property name
 */
public UtcProperty(final String name, PropertyFactory factory) {
  super(name, factory);
  setDate(new DateTime(true));
}

代码示例来源:origin: ical4j/ical4j

/**
 * Default constructor. The time value is initialised to the time of instantiation.
 */
public Due() {
  super(DUE, new Factory());
  // defaults to UTC time..
  setDate(new DateTime(true));
}

代码示例来源:origin: org.mnode.ical4j/ical4j

/**
 * Default constructor.
 */
public RecurrenceId() {
  super(RECURRENCE_ID, new Factory());
  setDate(new DateTime());
}

代码示例来源:origin: ical4j/ical4j

private DateTime calculateOnset(String dateStr) throws ParseException {
  // Translate local onset into UTC time by parsing local time 
  // as GMT and adjusting by TZOFFSETFROM if required
  long utcOnset;
  synchronized (UTC_FORMAT) {
    utcOnset = UTC_FORMAT.parse(dateStr).getTime();
  }
  // return a UTC
  DateTime onset = new DateTime(true);
  onset.setTime(utcOnset);
  return onset;
}

代码示例来源:origin: org.bedework/bw-ical4j-cl

/**
 * Default constructor. The time value is initialised to the time of instantiation.
 */
public Due() {
  super(DUE, PropertyFactoryImpl.getInstance());
  // defaults to UTC time..
  setDate(new DateTime(true));
}

代码示例来源:origin: org.bedework/bw-ical4j-cl

private DateTime calculateOnset(String dateStr) throws ParseException {
  
  // Translate local onset into UTC time by parsing local time 
  // as GMT and adjusting by TZOFFSETFROM if required
  long utcOnset;
    synchronized (UTC_FORMAT) {
    utcOnset = UTC_FORMAT.parse(dateStr).getTime();
  }
  // return a UTC
  DateTime onset = new DateTime(true);
  onset.setTime(utcOnset);
  return onset;
}

代码示例来源:origin: org.mnode.ical4j/ical4j

private DateTime calculateOnset(String dateStr) throws ParseException {
  // Translate local onset into UTC time by parsing local time 
  // as GMT and adjusting by TZOFFSETFROM if required
  long utcOnset;
  synchronized (UTC_FORMAT) {
    utcOnset = UTC_FORMAT.parse(dateStr).getTime();
  }
  // return a UTC
  DateTime onset = new DateTime(true);
  onset.setTime(utcOnset);
  return onset;
}

代码示例来源:origin: ical4j/ical4j

/**
 * Default constructor.
 */
public RecurrenceId() {
  super(RECURRENCE_ID, new Factory());
  setDate(new DateTime());
}

代码示例来源:origin: org.bedework.ical4j/ical4j

/**
 * Default constructor. The time value is initialised to the time of instantiation.
 */
public Due() {
  super(DUE, PropertyFactoryImpl.getInstance());
  // defaults to UTC time..
  setDate(new DateTime(true));
}

代码示例来源:origin: ical4j/ical4j

public void testAmericaIndiana() {
  java.util.TimeZone indianaTz = java.util.TimeZone
      .getTimeZone("America/Indiana/Indianapolis");
  Calendar cal = Calendar.getInstance(indianaTz);
  cal.set(Calendar.HOUR_OF_DAY, 10);
  cal.set(Calendar.MINUTE, 20);
  DateTime dtStart = new DateTime(cal.getTime());
  DtStart pDtStart = new DtStart(dtStart);
  pDtStart.setTimeZone(registry
      .getTimeZone("America/Indiana/Indianapolis"));
}

代码示例来源:origin: ical4j/ical4j

public final void test3() {
  java.util.Calendar cal = getCalendarInstance();
  // tomorrow..
  cal.add(java.util.Calendar.DAY_OF_MONTH, 1);
  cal.set(java.util.Calendar.HOUR_OF_DAY, 9);
  cal.set(java.util.Calendar.MINUTE, 30);
  VEvent meeting = new VEvent(new DateTime(cal.getTime().getTime()),
      java.time.Duration.ofHours(1), "Progress Meeting");
  // add timezone information..
  meeting.getProperty(Property.DTSTART).getParameters().add(tzParam);
  log.info(meeting.toString());
}

代码示例来源:origin: ical4j/ical4j

private DateTime applyOffsetFrom(DateTime orig) {
    DateTime withOffset = new DateTime(true);
    withOffset.setTime(orig.getTime() - (getOffsetFrom().getOffset().getTotalSeconds() * 1000L));
    return withOffset;
  }
}

代码示例来源:origin: ical4j/ical4j

/**
 * Unit tests for {@link Period#isEmpty()}.
 */
public void testIsEmpty() {
  Calendar cal = Calendar.getInstance();
  DateTime start = new DateTime(cal.getTime());
  assertTrue(new Period(start, start).isEmpty());
  assertTrue(new Period(start, java.time.Period.ZERO).isEmpty());
  
  cal.add(Calendar.SECOND, 1);
  assertFalse(new Period(start, new DateTime(cal.getTime())).isEmpty());
  assertFalse(new Period(start, java.time.Duration.ofSeconds(1)).isEmpty());
}

代码示例来源:origin: ical4j/ical4j

/**
 * A test to confirm that the end date is calculated correctly
 * from a given start date and duration, even when timezone is specified.
 */
public final void testEventEndDateWithTimeZone() throws ParseException {
  TimeZone timezone = new TimeZoneRegistryImpl().getTimeZone("Asia/Seoul");
  DateTime startDateTime = new DateTime("20181003T130000", timezone);
  log.info("Start date: " + startDateTime);
  VEvent event = new VEvent(startDateTime,
      java.time.Duration.ofHours(1), "1 hour event");
  assertEquals(new DateTime("20181003T140000", timezone), event.getEndDate().getDate());
}

代码示例来源:origin: ical4j/ical4j

public void testZuluToLocal() throws Exception {
  DateTime d = new DateTime(zuluDateTimeStr);
  d.setTimeZone(timezone);
  assertEquals(expectedLocalDateTimeStr, d.toString());
}

代码示例来源:origin: ical4j/ical4j

/**
 * Unit tests for value/timezone constructor.
 */
public void testDtStartStringTimezone() throws ParseException {
  String value = new DateTime().toString();
  DtStart dtStart = new DtStart(value, timezone);
  assertEquals(timezone, dtStart.getTimeZone());
  assertEquals(value, dtStart.getValue());
}

代码示例来源: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());
}

相关文章