org.eigenbase.util14.ZonelessDatetime.getCalendar()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(94)

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

ZonelessDatetime.getCalendar介绍

[英]Gets a temporary Calendar set to the specified time zone. The same Calendar is returned on subsequent calls.
[中]获取设置为指定时区的临时日历。后续通话会返回相同的日历。

代码示例

代码示例来源:origin: net.hydromatic/optiq

/**
 * Gets the value of this datetime as a milliseconds value for {@link
 * java.sql.Date}.
 *
 * @param zone time zone in which to generate a time value for
 */
public long getJdbcDate(TimeZone zone)
{
  Calendar cal = getCalendar(DateTimeUtil.gmtZone);
  cal.setTimeInMillis(getDateValue());
  int year = cal.get(Calendar.YEAR);
  int doy = cal.get(Calendar.DAY_OF_YEAR);
  cal.clear();
  cal.setTimeZone(zone);
  cal.set(Calendar.YEAR, year);
  cal.set(Calendar.DAY_OF_YEAR, doy);
  return cal.getTimeInMillis();
}

代码示例来源:origin: org.apache.optiq/optiq-core

/**
 * Gets the value of this datetime as a milliseconds value for {@link
 * java.sql.Date}.
 *
 * @param zone time zone in which to generate a time value for
 */
public long getJdbcDate(TimeZone zone) {
 Calendar cal = getCalendar(DateTimeUtil.GMT_ZONE);
 cal.setTimeInMillis(getDateValue());
 int year = cal.get(Calendar.YEAR);
 int doy = cal.get(Calendar.DAY_OF_YEAR);
 cal.clear();
 cal.setTimeZone(zone);
 cal.set(Calendar.YEAR, year);
 cal.set(Calendar.DAY_OF_YEAR, doy);
 return cal.getTimeInMillis();
}

代码示例来源:origin: org.apache.optiq/optiq-core

/**
 * Gets the value of this datetime as a milliseconds value for {@link
 * java.sql.Timestamp}.
 *
 * @param zone time zone in which to generate a time value for
 */
public long getJdbcTimestamp(TimeZone zone) {
 Calendar cal = getCalendar(DateTimeUtil.GMT_ZONE);
 cal.setTimeInMillis(internalTime);
 int year = cal.get(Calendar.YEAR);
 int doy = cal.get(Calendar.DAY_OF_YEAR);
 int hour = cal.get(Calendar.HOUR_OF_DAY);
 int minute = cal.get(Calendar.MINUTE);
 int second = cal.get(Calendar.SECOND);
 int millis = cal.get(Calendar.MILLISECOND);
 cal.clear();
 cal.setTimeZone(zone);
 cal.set(Calendar.YEAR, year);
 cal.set(Calendar.DAY_OF_YEAR, doy);
 cal.set(Calendar.HOUR_OF_DAY, hour);
 cal.set(Calendar.MINUTE, minute);
 cal.set(Calendar.SECOND, second);
 cal.set(Calendar.MILLISECOND, millis);
 return cal.getTimeInMillis();
}

代码示例来源:origin: net.hydromatic/optiq

/**
 * Gets the value of this datetime as a milliseconds value for {@link
 * java.sql.Timestamp}.
 *
 * @param zone time zone in which to generate a time value for
 */
public long getJdbcTimestamp(TimeZone zone)
{
  Calendar cal = getCalendar(DateTimeUtil.gmtZone);
  cal.setTimeInMillis(internalTime);
  int year = cal.get(Calendar.YEAR);
  int doy = cal.get(Calendar.DAY_OF_YEAR);
  int hour = cal.get(Calendar.HOUR_OF_DAY);
  int minute = cal.get(Calendar.MINUTE);
  int second = cal.get(Calendar.SECOND);
  int millis = cal.get(Calendar.MILLISECOND);
  cal.clear();
  cal.setTimeZone(zone);
  cal.set(Calendar.YEAR, year);
  cal.set(Calendar.DAY_OF_YEAR, doy);
  cal.set(Calendar.HOUR_OF_DAY, hour);
  cal.set(Calendar.MINUTE, minute);
  cal.set(Calendar.SECOND, second);
  cal.set(Calendar.MILLISECOND, millis);
  return cal.getTimeInMillis();
}

相关文章