Connect with one of the following accounts


Please wait while we redirect...

Views: 235   

Following program shows you how to convert hours to milliseconds.
In this program we get hours from user, once we get those we need to multiply with 60 so that we get in mintues, once we get mintues we need to multiply with 60 so that we get in seconds, once we get seconds we need to multiply with 1000 so that we get in milliseconds

import java.util.Scanner;

public class MathUnitConversions12 {

    public static void main(String[] args) {

        long hours;

        Scanner in = new Scanner(;

        System.out.println("Please enter hours:");
        hours = in.nextInt();

        long milliseconds = hours * 60 * 60 *1000;

        System.out.println(milliseconds + " Milliseconds");


Please enter hours:
7200000 Milliseconds

On By

Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News