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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:42:44+00:00 2026-05-27T01:42:44+00:00

I need to compare two times in java and make sure they are within

  • 0

I need to compare two times in java and make sure they are within ten minutes from each other. This would seem simple enough and was simple enough before Date was deprecated. Does anyone have any idea of how the best way to program this in java is? I saw the gregorian calendar but i dont see how to access the fields for minutes or day etc.

  • 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-27T01:42:44+00:00Added an answer on May 27, 2026 at 1:42 am

    Date.getTime() is not deprecated and gives you a long representing milliseconds since the epoch. You can use this as basis for such simple comparisons.

    long diffInMins = Math.abs(date1.getTime() - date2.getTime()) / 60000;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

could anyone assist me with this. I need to compare two beefy xml files
In a follow-up to this question , I need to compare two strings in
I want to compare two Java Map s by a simple hash. Each object
I have data from two spreadsheets where I need to compare the quantities of
I need to compare a textarea to make sure: It's not ONLY SPACES and
I need to compare two Date s (e.g. date1 and date2 ) and come
When you need to compare two tables to see what the differences are, are
in bash I need to compare two float numbers, one which I define in
I have a C++ application in which I need to compare two values and
I need to compare the integer part of two doubles for inequality and I'm

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.