java.sql.Timestamp.valueOf()のサンプル

サンプルコード
package com.arkgamer.study;

public class TimeStampDemo {

public static void main(String[] args) {
java.util.Date cft= new java.util.Date();
java.sql.Timestamp tsA = new java.sql.Timestamp(cft.getTime());
java.sql.Timestamp tsB = java.sql.Timestamp.valueOf(“2018-08-25 19:11:25");

long tsTimeA = tsA.getTime();
long tsTimeB = tsB.getTime();

System.out.println(“value1:" + tsTimeA);
System.out.println(“——————–“);
System.out.println(“value2:" + tsTimeB);
}

}

実行結果
value1:1535957319335
——————–
value2:1535191885000

Java

Posted by arkgame