本文整理了Java中java.sql.Timestamp.setTime()
方法的一些代码示例,展示了Timestamp.setTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timestamp.setTime()
方法的具体详情如下:
包路径:java.sql.Timestamp
类名称:Timestamp
方法名:setTime
[英]Sets the time represented by this Timestamp object to the supplied time, defined as the number of milliseconds since the Epoch (January 1 1970, 00:00:00.000 GMT).
[中]将此时间戳对象表示的时间设置为提供的时间,定义为自历元(1970年1月1日,00:00:00.000 GMT)起的毫秒数。
代码示例来源:origin: apache/hive
public void setTime(long time) {
timestamp.setTime(time);
bytesEmpty = true;
timestampEmpty = false;
}
代码示例来源:origin: apache/hive
@Override
public void reset () {
isNull = true;
this.value.setTime(0);
}
}
代码示例来源:origin: apache/flink
@Override
public Timestamp copy(Timestamp from, Timestamp reuse) {
if (from == null) {
return null;
}
reuse.setTime(from.getTime());
reuse.setNanos(from.getNanos());
return reuse;
}
代码示例来源:origin: apache/hive
/**
* Set a Timestamp object from a row of the column.
* We assume the entry has already been NULL checked and isRepeated adjusted.
* @param timestamp
* @param elementNum
*/
public void timestampUpdate(Timestamp timestamp, int elementNum) {
timestamp.setTime(time[elementNum]);
timestamp.setNanos(nanos[elementNum]);
}
代码示例来源:origin: apache/hive
/**
* Return the scratch Timestamp object set from a row.
* We assume the entry has already been NULL checked and isRepeated adjusted.
* @param elementNum
* @return
*/
public Timestamp asScratchTimestamp(int elementNum) {
scratchTimestamp.setTime(time[elementNum]);
scratchTimestamp.setNanos(nanos[elementNum]);
return scratchTimestamp;
}
代码示例来源:origin: apache/hive
public void set(Timestamp t) {
if (t == null) {
timestamp.setTime(0);
timestamp.setNanos(0);
return;
}
timestamp.setTime(t.getTime());
timestamp.setNanos(t.getNanos());
bytesEmpty = true;
timestampEmpty = false;
}
代码示例来源:origin: apache/hive
@Override
public void assignNullTimestamp(int keyIndex, int index) {
isNull[keyIndex] = true;
// assign 0 to simplify hashcode
timestampValues[index].setTime(ZERO_TIMESTAMP.getTime());
timestampValues[index].setNanos(ZERO_TIMESTAMP.getNanos());
}
代码示例来源:origin: apache/hive
public DateScalarAddIntervalDayTimeColumn(long value, int colNum, int outputColumnNum) {
super(outputColumnNum);
// Scalar input #1 is type date (days). For the math we convert it to a timestamp.
this.value = new Timestamp(0);
this.value.setTime(DateWritableV2.daysToMillis((int) value));
this.colNum = colNum;
}
代码示例来源:origin: apache/hive
/**
* Return a long representation of a Timestamp.
* @param elementNum
* @return
*/
public long getTimestampAsLong(int elementNum) {
scratchTimestamp.setTime(time[elementNum]);
scratchTimestamp.setNanos(nanos[elementNum]);
return getTimestampAsLong(scratchTimestamp);
}
代码示例来源:origin: apache/hive
public DateScalarSubtractTimestampColumn(long value, int colNum, int outputColumnNum) {
super(outputColumnNum);
// Scalar input #1 is type date (days). For the math we convert it to a timestamp.
this.value = new Timestamp(0);
this.value.setTime(DateWritableV2.daysToMillis((int) value));
this.colNum = colNum;
}
代码示例来源:origin: apache/hive
public DateScalarSubtractDateColumn(long value, int colNum, int outputColumnNum) {
super(outputColumnNum);
this.colNum = colNum;
this.value = new Timestamp(0);
this.value.setTime(DateWritableV2.daysToMillis((int) value));
}
代码示例来源:origin: apache/hive
public IntervalDayTimeColAddDateScalar(int colNum, long value, int outputColumnNum) {
super(outputColumnNum);
this.colNum = colNum;
this.value = new Timestamp(0);
this.value.setTime(DateWritableV2.daysToMillis((int) value));
}
代码示例来源:origin: apache/hive
public DateScalarSubtractIntervalDayTimeColumn(long value, int colNum, int outputColumnNum) {
super(outputColumnNum);
// Scalar input #1 is type date (days). For the math we convert it to a timestamp.
this.value = new Timestamp(0);
this.value.setTime(DateWritableV2.daysToMillis((int) value));
this.colNum = colNum;
}
代码示例来源:origin: apache/hive
/**
* Return a double representation of a Timestamp.
* @param elementNum
* @return
*/
public double getDouble(int elementNum) {
scratchTimestamp.setTime(time[elementNum]);
scratchTimestamp.setNanos(nanos[elementNum]);
return getDouble(scratchTimestamp);
}
代码示例来源:origin: apache/flink
@Override
public Timestamp deserialize(Timestamp reuse, DataInputView source) throws IOException {
final long v = source.readLong();
if (v == Long.MIN_VALUE) {
return null;
}
reuse.setTime(v);
reuse.setNanos(source.readInt());
return reuse;
}
代码示例来源:origin: apache/hive
@Deprecated
public boolean add(java.sql.Timestamp ts, HiveIntervalYearMonth interval, java.sql.Timestamp result) {
if (ts == null || interval == null) {
return false;
}
// Attempt to match Oracle semantics for timestamp arithmetic,
// where timestamp arithmetic is done in UTC, then converted back to local timezone
long resultMillis = addMonthsToMillis(ts.getTime(), interval.getTotalMonths());
result.setTime(resultMillis);
result.setNanos(ts.getNanos());
return true;
}
代码示例来源:origin: apache/hive
@Deprecated
public boolean add(HiveIntervalYearMonth interval, java.sql.Timestamp ts, java.sql.Timestamp result) {
if (ts == null || interval == null) {
return false;
}
long resultMillis = addMonthsToMillis(ts.getTime(), interval.getTotalMonths());
result.setTime(resultMillis);
result.setNanos(ts.getNanos());
return true;
}
代码示例来源:origin: apache/hive
private void populateTimestamp() {
long seconds = getSeconds();
int nanos = getNanos();
timestamp.setTime(seconds * 1000);
timestamp.setNanos(nanos);
}
代码示例来源:origin: apache/hive
public static void setTimestamp(Timestamp t, byte[] bytes, int offset) {
long seconds = getSeconds(bytes, offset);
t.setTime(seconds * 1000);
if (hasDecimalOrSecondVInt(bytes[offset])) {
t.setNanos(getNanos(bytes, offset + 4));
} else {
t.setNanos(0);
}
}
代码示例来源:origin: apache/hive
private void setMilliseconds(TimestampColumnVector timestampColVector,
long[] vector, int elementNum) {
timestampColVector.getScratchTimestamp().setTime(vector[elementNum]);
timestampColVector.setFromScratchTimestamp(elementNum);
}
内容来源于网络,如有侵权,请联系作者删除!