Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Converting Minutes

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Converting Minutes

    So I am trying to make a program where it converts minutes to hours and days. I have the hours part correct. Now I am trying to get the days part. I can not understand how to get it. Could someone help?


    import java.util.Scanner;
    public class MinutesConversion
    {
    public static void main(String[] args)
    {
    int minutes;
    int hours;
    Scanner input= new Scanner(System.in);
    System.out.print("Enter Minutes:");
    minutes = input.nextInt();
    hours= (minutes / 60);
    minutes %=60;
    System.out.print(hours + ":"+minutes);

    }
    }

  2. #2
    Member John Joe's Avatar
    Join Date
    Jun 2017
    Posts
    277
    My Mood
    Amused
    Thanks
    8
    Thanked 19 Times in 19 Posts

    Default Re: Converting Minutes

    To find day, you can use
    days = hours/24;
    Whatever you are, be a good one

Similar Threads

  1. Making a page to play music and reload after 4 minutes
    By shiftaction in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 20th, 2013, 08:08 PM
  2. Help wanted, 20$ a week - you only work a few minutes.
    By kxsb11 in forum Paid Java Projects
    Replies: 1
    Last Post: January 30th, 2012, 03:55 AM
  3. Converting decimal number to m minutes, n.nn seconds format.
    By coreysizemore in forum Java Theory & Questions
    Replies: 1
    Last Post: January 20th, 2012, 11:37 PM
  4. I want to extract minutes and seconds from duration
    By msa969 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 17th, 2011, 02:14 PM
  5. “Getting started with RMI” tutorial for beginners
    By danielstoner in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: October 7th, 2008, 11:18 PM

Tags for this Thread