1// get current time in java using LocalTime.now() method
2import java.time.LocalTime;
3public class UsingLocalDate
4{
5 public static void main(String[] args)
6 {
7 System.out.println(LocalTime.now());
8 // hr : min : sec.fimto sec
9 }
10}
1LocalDateTime date = LocalDateTime.now();
2int seconds = date.toLocalTime().toSecondOfDay();