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 6902777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:50:27+00:00 2026-05-27T07:50:27+00:00

In java what is the most effective way to get the time so that

  • 0

In java what is the most effective way to get the time so that you can compare it to another time taken later in the future?

More specifically, how can I get the hours and minutes (separately) of the current time as an integer value (as opposed to a string) to be used to compare later?

  • 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-27T07:50:28+00:00Added an answer on May 27, 2026 at 7:50 am

    Have a look at using the Java Calendar class, specifically, the .get(Calendar.HOUR) and .get(Calendar.MINUTE) methods.

    Don’t store the hour and minute values though, either store an instance of the Calendar class, or store the current UNIX timestamp, and compare those, obtaining the hours and minutes after performing the subtraction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the most efficient way in Java to get the 50 most frequent words
I've read lot of articles saying, that Java EE is most popular enterprise solution
What is the most efficient way to reverse a string in Java? Should I
What is the most concise way of converting a java.util.List into a normal JavaFX
In Java, what's generally the most accepted way to organize a class in terms
Why is C preferred instead of Java in most of the real time applications?
what would be the most effective way to implement search for a string in
I am currently re-reading Effective Java while working at a shop that makes heavy
What is most reliable and up to date Java/Android SDK for foursquare that covers
I remember reading a section, possibly in Bloch's Effective Java , that said that

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.