Imran_Mohammed

Time

Apr 21st, 2022
945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1.  
  2. import java.time.LocalTime;
  3. import java.time.format.DateTimeFormatter;
  4.  
  5.  
  6.  
  7. public class NewClass1 {
  8.    
  9.     public static void main(String[] args){
  10.        
  11.         LocalTime time = LocalTime.now();
  12.         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm:ss");
  13.         String formattedTime = time.format(formatter);
  14.         System.out.println(formattedTime);
  15.     }          
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment