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

x33g5p2x  于2022-01-30 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(136)

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

TimeZone.getTimeZone介绍

暂无

代码示例

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

protected Object initialValue() {
    final DateFormat format = new SimpleDateFormat(UTC_PATTERN);
    format.setTimeZone(TimeZone.getTimeZone(TimeZones.UTC_ID));
    format.setLenient(false);
    return (Object)format;
  }
};

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

/**
   * {@inheritDoc}
   */
  public String toString() {
    // if time is floating avoid daylight saving rules when generating
    // string representation of date..
    final java.util.TimeZone timeZone = format.getTimeZone();
    if (!(timeZone instanceof TimeZone)) {
      if (gmtFormat == null) {
        gmtFormat = (DateFormat) format.clone();
        gmtFormat.setTimeZone(TimeZone.getTimeZone(TimeZones.GMT_ID));
      }
      if (timeZone.inDaylightTime(this)
          && timeZone.inDaylightTime(new Date(getTime() - 1))) {

        return gmtFormat.format(new Date(getTime()
            + timeZone.getRawOffset()
            + timeZone.getDSTSavings()));
//                return format.format(new Date(getTime() - format.getTimeZone().getDSTSavings()));
      }
//            return gmtFormat.format(new Date(getTime() + format.getTimeZone().getOffset(getTime())));
      return gmtFormat.format(new Date(getTime() + timeZone.getRawOffset()));
    }
    return format.format(this);
  }

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

/**
   * {@inheritDoc}
   */
  public String toString() {
    // if time is floating avoid daylight saving rules when generating
    // string representation of date..
    final java.util.TimeZone timeZone = format.getTimeZone();
    if (!(timeZone instanceof TimeZone)) {
      if (gmtFormat == null) {
        gmtFormat = (DateFormat) format.clone();
        gmtFormat.setTimeZone(TimeZone.getTimeZone(TimeZones.GMT_ID));
      }
      if (timeZone.inDaylightTime(this)
          && timeZone.inDaylightTime(new Date(getTime() - 1))) {

        return gmtFormat.format(new Date(getTime()
            + timeZone.getRawOffset()
            + timeZone.getDSTSavings()));
//                return format.format(new Date(getTime() - format.getTimeZone().getDSTSavings()));
      }
//            return gmtFormat.format(new Date(getTime() + format.getTimeZone().getOffset(getTime())));
      return gmtFormat.format(new Date(getTime() + timeZone.getRawOffset()));
    }
    return format.format(this);
  }

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

/**
   * {@inheritDoc}
   */
  public String toString() {
    // if time is floating avoid daylight saving rules when generating
    // string representation of date..
    final java.util.TimeZone timeZone = format.getTimeZone();
    if (!(timeZone instanceof TimeZone)) {
      if (gmtFormat == null) {
        gmtFormat = (DateFormat) format.clone();
        gmtFormat.setTimeZone(TimeZone.getTimeZone(TimeZones.GMT_ID));
      }
      if (timeZone.inDaylightTime(this)
          && timeZone.inDaylightTime(new Date(getTime() - 1))) {

        return gmtFormat.format(new Date(getTime()
            + timeZone.getRawOffset()
            + timeZone.getDSTSavings()));
//                return format.format(new Date(getTime() - format.getTimeZone().getDSTSavings()));
      }
//            return gmtFormat.format(new Date(getTime() + format.getTimeZone().getOffset(getTime())));
      return gmtFormat.format(new Date(getTime() + timeZone.getRawOffset()));
    }
    return format.format(this);
  }

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

/**
   * {@inheritDoc}
   */
  public String toString() {
    // if time is floating avoid daylight saving rules when generating
    // string representation of date..
    final java.util.TimeZone timeZone = format.getTimeZone();
    if (!(timeZone instanceof TimeZone)) {
      if (gmtFormat == null) {
        gmtFormat = (DateFormat) format.clone();
        gmtFormat.setTimeZone(TimeZone.getTimeZone(TimeZones.GMT_ID));
      }
      if (timeZone.inDaylightTime(this)
          && timeZone.inDaylightTime(new Date(getTime() - 1))) {

        return gmtFormat.format(new Date(getTime()
            + timeZone.getRawOffset()
            + timeZone.getDSTSavings()));
//                return format.format(new Date(getTime() - format.getTimeZone().getDSTSavings()));
      }
//            return gmtFormat.format(new Date(getTime() + format.getTimeZone().getOffset(getTime())));
      return gmtFormat.format(new Date(getTime() + timeZone.getRawOffset()));
    }
    return format.format(this);
  }

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

/**
   * {@inheritDoc}
   */
  public String toString() {
    // if time is floating avoid daylight saving rules when generating
    // string representation of date..
    if (!(format.getTimeZone() instanceof TimeZone)) {
      if (gmtFormat == null) {
        gmtFormat = (DateFormat) format.clone();
        gmtFormat.setTimeZone(TimeZone.getTimeZone(TimeZones.GMT_ID));
      }
      if (format.getTimeZone().inDaylightTime(this)
          && format.getTimeZone().inDaylightTime(new Date(getTime() - 1))) {
        
        return gmtFormat.format(new Date(getTime()
            + format.getTimeZone().getRawOffset()
            + format.getTimeZone().getDSTSavings()));
//                return format.format(new Date(getTime() - format.getTimeZone().getDSTSavings()));
      }
//            return gmtFormat.format(new Date(getTime() + format.getTimeZone().getOffset(getTime())));
      return gmtFormat.format(new Date(getTime() + format.getTimeZone().getRawOffset()));
    }
    return format.format(this);
  }

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

/**
 * Updates this date-time to display in UTC time if the argument is true. Otherwise, resets to the default timezone.
 * @param utc The utc to set.
 */
public final void setUtc(final boolean utc) {
  // reset the timezone associated with this instance..
  this.timezone = null;
  if (utc) {
    getFormat().setTimeZone(TimeZone.getTimeZone(TimeZones.UTC_ID));
  }
  else {
    resetTimeZone();
  }
  time = new Time(time, getFormat().getTimeZone(), utc);
}

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

Calendar expectedCal = Calendar.getInstance(TimeZone.getTimeZone(TimeZones.GMT_ID));
expectedCal.set(2005, Calendar.APRIL, 1, 9, 0, 0);
expectedCal.set(Calendar.MILLISECOND, 0);

相关文章