net.fortuna.ical4j.model.Date.getTime()方法的使用及代码示例

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

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

Date.getTime介绍

暂无

代码示例

代码示例来源:origin: micromata/projectforge

public static java.sql.Date getSqlDate(final net.fortuna.ical4j.model.Date ical4jDate)
{
 if (ical4jDate == null) {
  return null;
 }
 return new java.sql.Date(ical4jDate.getTime());
}

代码示例来源:origin: micromata/projectforge

public static java.sql.Timestamp getSqlTimestamp(final net.fortuna.ical4j.model.Date ical4jDate)
{
 if (ical4jDate == null) {
  return null;
 }
 return new java.sql.Timestamp(ical4jDate.getTime());
}

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

/**
 * Returns a cached onset for the specified date.
 * @param date
 * @return a cached onset date or null if no cached onset is applicable for the specified date
 */
private DateTime getCachedOnset(final Date date) {
  int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
  if (index >= 0) {
    return onsetsDates[index];
  } else {
    int insertionIndex = -index -1;
    return onsetsDates[insertionIndex -1];
  }
}

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

/**
 * Returns a cached onset for the specified date.
 *
 * @param date
 * @return a cached onset date or null if no cached onset is applicable for the specified date
 */
private DateTime getCachedOnset(final Date date) {
  int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
  if (index >= 0) {
    return onsetsDates[index];
  } else {
    int insertionIndex = -index - 1;
    return onsetsDates[insertionIndex - 1];
  }
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

/**
 * Returns a cached onset for the specified date.
 *
 * @param date
 * @return a cached onset date or null if no cached onset is applicable for the specified date
 */
private DateTime getCachedOnset(final Date date) {
  int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
  if (index >= 0) {
    return onsetsDates[index];
  } else {
    int insertionIndex = -index - 1;
    return onsetsDates[insertionIndex - 1];
  }
}

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

/**
 * Returns a cached onset for the specified date.
 *
 * @param date
 * @return a cached onset date or null if no cached onset is applicable for the specified date
 */
private DateTime getCachedOnset(final Date date) {
  int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
  if (index >= 0) {
    return onsetsDates[index];
  } else {
    int insertionIndex = -index - 1;
    return onsetsDates[insertionIndex - 1];
  }
}

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

/**
 * Returns a cached onset for the specified date.
 *
 * @param date
 * @return a cached onset date or null if no cached onset is applicable for the specified date
 */
private DateTime getCachedOnset(final Date date) {
  int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
  if (index >= 0) {
    return onsetsDates[index];
  } else {
    int insertionIndex = -index - 1;
    return onsetsDates[insertionIndex - 1];
  }
}

代码示例来源:origin: PrivacyApps/calendar-import-export

private void copyDateProperty(ContentValues c, String dbName, String dbTzName, DateProperty date) {
  if (dbName != null && date.getDate() != null) {
    c.put(dbName, date.getDate().getTime()); // ms since epoc in GMT
    if (dbTzName != null) {
      if (date.isUtc() || date.getTimeZone() == null)
        c.put(dbTzName, "UTC");
      else
        c.put(dbTzName, date.getTimeZone().getID());
    }
  }
}

代码示例来源:origin: micromata/projectforge

@Override
 public boolean fromVEvent(final TeamEventDO event, final VEvent vEvent)
 {
  if (vEvent.getDateStamp() != null) {
   event.setDtStamp(new Timestamp(vEvent.getDateStamp().getDate().getTime()));
   return true;
  }

  return false;
 }
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

/**
 * @return a version value in microsecords.
 */
@NoDump
public long getMicrosecsVersion() throws CalFacadeException {
 try {
  final String[] ct = getCtoken().split("-");
  return new LastModified(ct[0]).getDate().getTime() * 1000000 +
      Integer.parseInt(ct[1], 16) * 100;
 } catch (final Throwable t) {
  throw new CalFacadeException(t);
 }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

if(instance.getRid().getTime()==occurrence.getTime()) {
  return true;

代码示例来源:origin: 1and1/cosmo

if(instance.getRid().getTime()==occurrence.getTime()) {
  return true;

代码示例来源:origin: 1and1/cosmo

/**
   * Calculate rank of NoteItem.  Rank is the absolute value of the
   * triageStatus rank.  If triageStatus rank is not present, then
   * it is the value in milliseconds of the start time of the event.
   * If the note is not an event then it is the last modified date.
   */
  private long getRank(NoteItem note) {
    // Use triageStatusRank * 1000 to normalize to
    // unix timestamp in milliseconds. 
    if(note.getTriageStatus()!=null && note.getTriageStatus().getRank()!=null) {
      return note.getTriageStatus().getRank().scaleByPowerOfTen(3).longValue();
    }
    
    // otherwise use startDate * -1
    BaseEventStamp eventStamp = StampUtils.getBaseEventStamp(note);
    if(eventStamp!=null) {
      return eventStamp.getStartDate().getTime()*-1;
    }
    
    // or occurrence date * -1
    if(note instanceof NoteOccurrence) {
      return ((NoteOccurrence) note).getOccurrenceDate().getTime()*-1;
    }
    
    // use modified date * -1 as a last resort
    return note.getModifiedDate().getTime()*-1;
  }
}

代码示例来源:origin: micromata/projectforge

@Override
public Property toVEvent(final TeamEventDO event)
{
 net.fortuna.ical4j.model.Date date;
 if (event.isAllDay() == true) {
  final Date endUtc = CalendarUtils.getUTCMidnightDate(event.getEndDate());
  final org.joda.time.DateTime jodaTime = new org.joda.time.DateTime(endUtc);
  // TODO sn should not be done
  // requires plus 1 because one day will be omitted by calendar.
  final net.fortuna.ical4j.model.Date fortunaEndDate = new net.fortuna.ical4j.model.Date(jodaTime.plusDays(1).toDate());
  date = new net.fortuna.ical4j.model.Date(fortunaEndDate.getTime());
 } else {
  date = new DateTime(event.getEndDate());
  ((net.fortuna.ical4j.model.DateTime) date).setTimeZone(TIMEZONE_REGISTRY.getTimeZone(event.getTimeZone().getID()));
 }
 return new DtEnd(date);
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-api

/**
   * Calculate rank of NoteItem.  Rank is the absolute value of the
   * triageStatus rank.  If triageStatus rank is not present, then
   * it is the value in milliseconds of the start time of the event.
   * If the note is not an event then it is the last modified date.
   */
  private long getRank(NoteItem note) {
    // Use triageStatusRank * 1000 to normalize to
    // unix timestamp in milliseconds. 
    if(note.getTriageStatus()!=null && note.getTriageStatus().getRank()!=null) {
      return note.getTriageStatus().getRank().scaleByPowerOfTen(3).longValue();
    }
    
    // otherwise use startDate * -1
    BaseEventStamp eventStamp = StampUtils.getBaseEventStamp(note);
    if(eventStamp!=null) {
      return eventStamp.getStartDate().getTime()*-1;
    }
    
    // or occurrence date * -1
    if(note instanceof NoteOccurrence) {
      return ((NoteOccurrence) note).getOccurrenceDate().getTime()*-1;
    }
    
    // use modified date * -1 as a last resort
    return note.getModifiedDate().getTime()*-1;
  }
}

代码示例来源:origin: micromata/projectforge

@Override
 public boolean fromVEvent(final TeamEventDO event, final VEvent vEvent)
 {
  final boolean isAllDay = this.isAllDay(vEvent);

  if (vEvent.getProperties().getProperties(Property.DTEND).isEmpty()) {
   return false;
  }

  if (isAllDay) {
   // TODO sn change behaviour to iCal standard
   final org.joda.time.DateTime jodaTime = new org.joda.time.DateTime(vEvent.getEndDate().getDate());
   final net.fortuna.ical4j.model.Date fortunaEndDate = new net.fortuna.ical4j.model.Date(jodaTime.plusDays(-1).toDate());
   event.setEndDate(new Timestamp(fortunaEndDate.getTime()));
  } else {
   event.setEndDate(ICal4JUtils.getSqlTimestamp(vEvent.getEndDate().getDate()));
  }

  return true;
 }
}

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

/**
 * @return a version value in microseconds.
 */
@NoDump
@JsonIgnore
public long getMicrosecsVersion() throws CalFacadeException {
 try {
  return new LastModified(getLastmod().getTimestamp()).getDate().getTime() * 1000000 +
      getLastmod().getSequence();
 } catch (final Throwable t) {
  throw new CalFacadeException(t);
 }
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * ICU4J generates VTIMEZONE RRULEs with floating UNTIL, which results
 * in a bad VTIMEZONE because the UNTIL is converted to UTC, which will
 * be different depending on the default timezone of the server.  So
 * to fix this, always add a day to UNTIL to make sure the RRULE
 * doesn't fall short.  This should work for most timezones as timezones
 * don't usually change from day to day.  Hopefully this is fixed in
 * an icu4j update.
 * @param vtz
 */
protected static void fixIcuVTimeZone(VTimeZone vtz) {
  for(Iterator<Observance> obIt = vtz.getObservances().iterator();obIt.hasNext();) {
    PropertyList<RRule> rruleList= obIt.next().getProperties(Property.RRULE);
    for(RRule rrule: rruleList) {
      Recur recur = rrule.getRecur();
      if(recur.getUntil()!=null) {
        recur.getUntil().setTime(recur.getUntil().getTime() + ONE_DAY);
      }
    }
  }
}

代码示例来源:origin: 1and1/cosmo

/**
 * ICU4J generates VTIMEZONE RRULEs with floating UNTIL, which results
 * in a bad VTIMEZONE because the UNTIL is converted to UTC, which will
 * be different depending on the default timezone of the server.  So
 * to fix this, always add a day to UNTIL to make sure the RRULE
 * doesn't fall short.  This should work for most timezones as timezones
 * don't usually change from day to day.  Hopefully this is fixed in
 * an icu4j update.
 * @param vtz
 */
protected static void fixIcuVTimeZone(VTimeZone vtz) {
  for(Iterator<Observance> obIt = vtz.getObservances().iterator();obIt.hasNext();) {
    PropertyList<RRule> rruleList= obIt.next().getProperties(Property.RRULE);
    for(RRule rrule: rruleList) {
      Recur recur = rrule.getRecur();
      if(recur.getUntil()!=null) {
        recur.getUntil().setTime(recur.getUntil().getTime() + ONE_DAY);
      }
    }
  }
}

代码示例来源:origin: micromata/projectforge

private boolean preCheckSendMail(final TeamEventDO event)
{
 // check event ownership
 if (event.isOwnership() != null && event.isOwnership() == false) {
  return false;
 }
 // check date, send mails for future events only
 final Date now = new Date();
 if (event.getStartDate().after(now)) {
  return true;
 }
 // No recurrence so event is in the past
 if (event.getRecurrenceRule() == null) {
  return false;
 }
 // Check rrule to see if an until date exists
 try {
  final RRule rRule = new RRule(event.getRecurrenceRule());
  final net.fortuna.ical4j.model.Date until = rRule.getRecur().getUntil();
  if (until == null) {
   return true;
  }
  final Date untilDate = new Date(until.getTime());
  return untilDate.before(now) == false;
 } catch (ParseException e) {
  return false;
 }
}

相关文章