[Java入門]java.sql.Timestamp.after()のサンプル

Javaコード
package test;

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class AfterNowDemo {

public static void main(String[] args) {
Timestamp cftTime = null;
try {
cftTime = new Timestamp(new SimpleDateFormat(“yyyy/MM/dd").parse(“2015/03/05").getTime());
Timestamp now = new Timestamp(System.currentTimeMillis());
boolean ctn = now.after(cftTime);
System.out.println(ctn);
} catch (ParseException e) {
e.printStackTrace();
}

}

}

結果
true

Java

Posted by arkgame