当前位置: 首页>>代码示例>>Java>>正文


Java Timestamp.setTime方法代码示例

本文整理汇总了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));
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:43,代码来源:Alos.java

示例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");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TimestampTests.java

示例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;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:jdbcResultSet.java


注:本文中的java.sql.Timestamp.setTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。