Answers for "How to get time now hours, minutes, seconds Each one separately"

0

How to get time now hours, minutes, seconds Each one separately

package com.zetcode;

import java.time.LocalTime;

public class JavaLocalTimeParts {

    public static void main(String[] args) {

        LocalTime time = LocalTime.now();

        System.out.printf("Hour: %s%n", time.getHour());
        System.out.printf("Minute: %s%n", time.getMinute());
        System.out.printf("Second: %s%n", time.getSecond());
    }
}

	//The getHour() gets the hour part, the getMinute() gets the minute part, and the getSecond() the second part of the LocalTime.
	
	//This is the output.
	//Hour: 18
	//Minute: 25
	//Second: 55
Posted by: Guest on June-01-2021

Code answers related to "How to get time now hours, minutes, seconds Each one separately"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language