java.text.DateFormat.getTimeZone()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(238)

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

DateFormat.getTimeZone介绍

[英]Returns the time zone of this date format's calendar.
[中]返回此日期格式日历的时区。

代码示例

代码示例来源:origin: looly/hutool

/**
 * 构造
 * 
 * @see DatePattern
 * @param dateStr Date字符串
 * @param dateFormat 格式化器 {@link SimpleDateFormat}
 */
public DateTime(String dateStr, DateFormat dateFormat) {
  this(parse(dateStr, dateFormat), dateFormat.getTimeZone());
}

代码示例来源:origin: looly/hutool

/**
 * 构造
 * 
 * @see DatePattern
 * @param dateStr Date字符串
 * @param dateFormat 格式化器 {@link SimpleDateFormat}
 */
public DateTime(String dateStr, DateFormat dateFormat) {
  this(parse(dateStr, dateFormat), dateFormat.getTimeZone());
}

代码示例来源:origin: jphp-group/jphp

public DateFormat getDateFormat(WrapTime time) {
  if (dateFormat.getTimeZone().equals(time.timeZone))
    return dateFormat;
  else {
    DateFormat dt = (DateFormat)dateFormat.clone();
    dt.setTimeZone(time.timeZone);
    return dt;
  }
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

private DateFormat fetchFromPool() {
  DateFormat format = (DateFormat)pool.fetchFromPool();
  TimeZone tz = timeZone != null ? timeZone : TimeZone.getDefault();
  if (!tz.equals(format.getTimeZone())) {
    format.setTimeZone(tz);
  }
  return format;
}

代码示例来源:origin: jphp-group/jphp

public DateFormat getDateFormat(TimeZone zone) {
  if (dateFormat.getTimeZone().equals(zone))
    return dateFormat;
  else {
    DateFormat dt = (DateFormat)dateFormat.clone();
    dt.setTimeZone(zone);
    return dt;
  }
}

代码示例来源:origin: stackoverflow.com

return localSimpleDateFormat.get().getTimeZone();

代码示例来源:origin: eu.ralph-schuster/csv

/**
   * Returns the timezone this handler uses.
   * @return timezone
   */
  public TimeZone getTimezone() {
    if (timezone == null) {
      if (printFormatter != null) return printFormatter.getTimeZone();
      return TimeZone.getDefault();
    }
    return timezone;
  }
}

代码示例来源:origin: stackoverflow.com

Date date= new Date();
 SimpleDateFormat sf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
 sf.format(date);
 TimeZone tz = TimeZone.getTimeZone("GMT") OR TimeZone tz =  sf.getTimeZone();      
 TimeZone tz1 = TimeZone.getTimeZone("EST");     
 Date c= shiftTimeZone( date,tz,tz1);
 System.out.println("Format :   " + sf.format(c));

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public TimeZone getTimeZone()
{
  return delegate.get().getTimeZone();
}

代码示例来源:origin: cn.hutool/hutool-all

/**
 * 构造
 * 
 * @see DatePattern
 * @param dateStr Date字符串
 * @param dateFormat 格式化器 {@link SimpleDateFormat}
 */
public DateTime(String dateStr, DateFormat dateFormat) {
  this(parse(dateStr, dateFormat), dateFormat.getTimeZone());
}

代码示例来源:origin: org.jvnet.hudson/xstream

private DateFormat fetchFromPool() {
    TimeZone tz = TimeZone.getDefault();
    DateFormat format = (DateFormat)pool.fetchFromPool();
    if (!tz.equals(format.getTimeZone())) {
      format.setTimeZone(tz);
    }
    return format;
  }
}

代码示例来源:origin: com.haulmont.thirdparty/xstream

private DateFormat fetchFromPool() {
  DateFormat format = (DateFormat)pool.fetchFromPool();
  TimeZone tz = timeZone != null ? timeZone : TimeZone.getDefault();
  if (!tz.equals(format.getTimeZone())) {
    format.setTimeZone(tz);
  }
  return format;
}

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

/**
 * @param time
 *            a date-time value in milliseconds
 */
public DateTime(final long time) {
  super(time, Dates.PRECISION_SECOND, java.util.TimeZone.getDefault());
  this.time = new Time(time, getFormat().getTimeZone());
}

代码示例来源:origin: io.snappydata/snappydata-store-core

private DateFormat setDateFormatCalendar( DateFormat df, Calendar cal)
{
  if( cal != null && df.getTimeZone() != cal.getTimeZone())
  {
    // The DateFormat returned by getDateFormat may be cached and used
    // by other threads.  Therefore we cannot change its calendar.
    df = (DateFormat) df.clone();
    df.setCalendar( cal);
  }
  return df;
}

代码示例来源:origin: io.snappydata/gemfirexd

private DateFormat setDateFormatCalendar( DateFormat df, Calendar cal)
{
  if( cal != null && df.getTimeZone() != cal.getTimeZone())
  {
    // The DateFormat returned by getDateFormat may be cached and used
    // by other threads.  Therefore we cannot change its calendar.
    df = (DateFormat) df.clone();
    df.setCalendar( cal);
  }
  return df;
}

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

/**
 * @param time
 *            a date-time value in milliseconds
 */
public DateTime(final long time) {
  super(time, Dates.PRECISION_SECOND, java.util.TimeZone.getDefault());
  this.time = new Time(time, getFormat().getTimeZone());
}

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

/**
 * @param time a date-time value in milliseconds
 */
public DateTime(final long time) {
  super(time, Dates.PRECISION_SECOND, java.util.TimeZone.getDefault());
  this.time = new Time(time, getFormat().getTimeZone());
}

代码示例来源:origin: EvoSuite/evosuite

public TimeZone getTimeZone()
{
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, "getTimeZone", "()Ljava/util/TimeZone;", new Object[] {});
  TimeZone ret = super.getTimeZone();
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, ret);
  return ret;
}

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

/**
 * Default constructor.
 */
public DateTime() {
  super(Dates.PRECISION_SECOND, java.util.TimeZone.getDefault());
  this.time = new Time(getTime(), getFormat().getTimeZone());
}

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

/**
 * Default constructor.
 */
public DateTime() {
  super(Dates.PRECISION_SECOND, java.util.TimeZone.getDefault());
  this.time = new Time(getTime(), getFormat().getTimeZone());
}

相关文章