java get time+ code example
Example 1: java get current time in seconds
LocalDateTime date = LocalDateTime.now();
int seconds = date.toLocalTime().toSecondOfDay();
Example 2: java getTime
String formatCode = "yyyy-MM-dd 'at' HH:mm:ss z"; // Example
SimpleDateFormat formatter = new SimpleDateFormat(formatCode); // Time Formatter
Date date = new Date(System.currentTimeMillis);
String time = formatter.format(date);
// e.g. time = 2021-04-15 at 11:11:11 UTC