タイムスタンプjava
package com.arigo;
import java.sql.Timestamp;
import java.time.LocalDateTime;
public class DateMaker {
public DateMaker() {
}
public static void main(String[] args)
{
DateMaker make = new DateMaker();
Timestamp tmp = make.timeMake();
System.out.println(tmp);
}
public Timestamp timeMake() {
int h = (int) (Math.random() * 10) % 12 + 1;
int m = (int) (Math.random() * 10) % 60 + 1;
int s = (int) (Math.random() * 10) % 60 + 1;
int n = (int)(Math.random()*1000000000);
LocalDateTime date = LocalDateTime.of(2019, 1, 1, h, m, s, n);
Timestamp tmp = Timestamp.valueOf(date);
return tmp;
}
}