本文整理汇总了Java中java.sql.Timestamp.setTime方法的典型用法代码示例。如果您正苦于以下问题:Java Timestamp.setTime方法的具体用法?Java Timestamp.setTime怎么用?Java Timestamp.setTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.Timestamp
的用法示例。
在下文中一共展示了Timestamp.setTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setXMLMetaData
import java.sql.Timestamp; //导入方法依赖的package包/类
/**
*
* @param productxml
* @param safeReader
* @param annotationReader
* @throws TransformException
*/
protected void setXMLMetaData() {
setSatellite(new String("ALOS"));
//polarizations string
List<String> pols=prop.getPolarizations();
String strPol="";
for (String p:pols) {
strPol=strPol.concat(p).concat(" ");
}
setPolarization(strPol);
setSensor("ALOS");
setSatelliteOrbitInclination(98.18);
setRangeSpacing(new Float(prop.getPixelSpacing()));
setAzimuthSpacing(new Float(prop.getPixelSpacing()));
setMetaHeight(prop.getNumberOfLines());
setMetaWidth(prop.getNumberOfPixels());
setNumberBands(pols.size());
setNumberOfBytes(16);
//TODO:check this value
//float enl=org.geoimage.impl.ENL.getFromGeoImageReader(this);
setENL("1");//String.valueOf(enl));
/*String start=header.getStartTime().toString().replace('T', ' ');
String stop=header.getStopTime().toString().replace('T', ' ');*/
Date st=prop.getStartDate();
Date end=prop.getEndDate();
Timestamp t=new Timestamp(st.getTime());
setTimeStampStart(t.toString());//Timestamp.valueOf(start));
t.setTime(end.getTime());
setTimeStampStop(t.toString());//Timestamp.valueOf(stop));
}
示例2: test36
import java.sql.Timestamp; //导入方法依赖的package包/类
@Test
public void test36() {
Timestamp ts1 = Timestamp.valueOf("1966-08-30 08:08:08");
Timestamp ts2 = Timestamp.valueOf("1961-08-30 00:00:00");
ts2.setTime(ts1.getTime());
assertTrue(ts2.getTime() == ts1.getTime(),
"ts1.getTime() != ts2.getTime()");
assertTrue(ts1.equals(ts2), "Error ts1 != ts2");
}
示例3: getTimestamp
import java.sql.Timestamp; //导入方法依赖的package包/类
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a
* <code>java.sql.Timestamp</code> object in the Java programming
* anguage.
* This method uses the given calendar to construct an appropriate
* millisecond value for the timestamp if the underlying database does
* not store timezone information. <p>
* <!-- end generic documentation -->
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param cal the <code>java.util.Calendar</code> object
* to use in constructing the timestamp
* @return the column value as a <code>java.sql.Timestamp</code> object;
* if the value is SQL <code>NULL</code>,
* the value returned is <code>null</code> in the Java programming
* language
* @exception SQLException if a database access error occurs
* @since JDK 1.2 (JDK 1.1.x developers: read the new overview for
* jdbcResultSet)
*/
public Timestamp getTimestamp(int columnIndex,
Calendar cal) throws SQLException {
Timestamp ts = getTimestamp(columnIndex);
if (cal != null && ts != null) {
ts.setTime(HsqlDateTime.getTimeInMillis(ts, null, cal));
}
return ts;
}