java get current timestamp formatted code example
Example 1: get current date time timestamp java
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
Date date = new Date();
Timestamp timestamp2 = new Timestamp(date.getTime());
Timestamp ts = Timestamp.from(Instant.now())
Timestamp ts = Timestamp.from(ZonedDateTime.now().toInstant()));
Instant instant = ts.toInstant();
Example 2: java timestamp format
Timestamp(int year, int month, int date, int hour, int minute, int second, int nano)