Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6775115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:52:06+00:00 2026-05-26T15:52:06+00:00

I need System.currentTimeMillis() to be converted into 3 variables: int Years; int DaysMonths; int

  • 0

I need System.currentTimeMillis() to be converted into 3 variables:

int Years;
int DaysMonths;
int MinutesHours;

What I mean by DayMonths, and MinutesHours is that, let’s say for example we have 2 hours. Then MinutesHours should equale 120 (because 2hours = 120 minutes). But once it reaches 24hours, it should be 0 and passe it to DaysMonths.
Same thing for the DaysMonths variable.

And I also need to know how to get this thing reversed. Using this 3 variables, I need an other method to get the System.currentTimeMillis() from them.

I’m having hard time to explain this, but I hope you know what I mean. I really hate dealing with time in java. It’s not my thing, but I need it really bad for a game project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:52:07+00:00Added an answer on May 26, 2026 at 3:52 pm

    Create a Calendar object:

    long millis=System.currentTimeMillis();
    Calendar c=Calendar.getInstance();
    c.setTimeInMillis(millis);
    

    After this you can get the fields from the Calendar object:

    int hours=c.get(Calendar.HOUR);
    int minutes=c.get(Calendar.MINUTE);
    

    Then:

    int MinutesHours=(hours*60)+minutes;
    

    To go back, you can use the set method in Calendar:

    Calendar c=Calendar.getInstance();
    c.set(Calendar.MINUTE,minutes);
    long millis=c.getTimeInMillis();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm on a foreign linux system and need to determine the user that apache
I need to set a system environment variable from a Bash script that would
For example, I rarely need: using System.Text; but it's always there by default. I
For a system I need to convert a pointer to a long then the
I need to use system-specific functions, e.g. ftello() (defined in stdio.h as per POSIX
For an embedded system I need to place a few data structures at fixed
I have a paradox table from a legacy system I need to run a
I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in
I need to develop a system for storing large numbers (10's to 100's of
I need to read the system clock (time and date) and display it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.