Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.time.LocalTime;
- import java.time.format.DateTimeFormatter;
- public class NewClass1 {
- public static void main(String[] args){
- LocalTime time = LocalTime.now();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm:ss");
- String formattedTime = time.format(formatter);
- System.out.println(formattedTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment