gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-20 18:54:31 27 4
gpt4 key购买 nike

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

ZonelessDatetime.setZonedTime介绍

暂无

代码示例

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

public void setZonedTime(long value, TimeZone zone)
{
  super.setZonedTime(value, zone);
  clearDate();
}

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

public void setZonedTime(long value, TimeZone zone)
{
  super.setZonedTime(value, zone);
  clearTime();
}

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

public void setZonedTime(long value, TimeZone zone) {
 super.setZonedTime(value, zone);
 clearDate();
}

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

public void setZonedTime(long value, TimeZone zone) {
 super.setZonedTime(value, zone);
 clearTime();
}

代码示例来源:origin: cascading/lingual-core

@Override
public Object coerce( Object value, Type to )
 {
 if( value == null )
  return null;
 Class from = value.getClass();
 if( from != Integer.class )
  throw new IllegalStateException( "was not normalized" );
 // no coercion, or already in canonical form
 if( to == Integer.class || to == int.class || to == Object.class )
  return value;
 if( to == Long.class )
  return ( (Integer) value ).intValue();
 // offset by the current timezone so we get only yyyy-mm-hh precision per the spec for DATE
 // Even with a "cast" of DATE to TIMESTAMP the value should be considered "yyyy-mm-hh 00:00:00"
 Calendar calendar = Calendar.getInstance();
 int timezoneOffset = calendar.get( Calendar.ZONE_OFFSET ) + calendar.get( Calendar.DST_OFFSET );
 long shiftedTime = ( ( (Integer) value ).longValue() * MILLIS_PER_DAY ) + timezoneOffset;
 ZonelessDatetime date = createInstance();
 date.setZonedTime( shiftedTime, DateTimeUtil.defaultZone );
 if( to == String.class )
  return date.toString();
 if( to == java.sql.Date.class )
  return new java.sql.Date( date.getJdbcDate( DateTimeUtil.defaultZone ) );
 if( to == java.sql.Timestamp.class )
  return new java.sql.Timestamp( date.getJdbcTimestamp( DateTimeUtil.defaultZone ) );
 if( to == java.sql.Time.class )
  return new java.sql.Time( date.getJdbcTime( DateTimeUtil.defaultZone ) );
 throw new CascadingException( "unknown type coercion requested, from: " + Util.getTypeName( from ) + " to: " + Util.getTypeName( to ) );
 }

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com