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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:14:14+00:00 2026-05-21T23:14:14+00:00

I have the following format for time hh:mm:ss . Now I have two time

  • 0

I have the following format for time “hh:mm:ss” .
Now I have two time values such as,

Date previous_time=20:50:55
Date current_time=19:50:55

And I am trying to compare it like this,

if(previous_time.after(current_date)){
  Log.i("Time Comparision","before is true");
      System.out.println("before");  
}
else if(current_time.after(previous_time)){
  Log.i("Time Comparision","after is true");
  System.out.println("after");   
}
else {
  System.out.println("nothing");
  Log.i("Time Comparision not happened","");
}

But both my if conditions are not working.
My question is, how to compare two times when they are in the above mentioned format?

  • 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-21T23:14:15+00:00Added an answer on May 21, 2026 at 11:14 pm

    In your first line of code you refer to current_date not current_time.

    Either that’s the problem or the two dates are equal, which would execute the part in else.

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

Sidebar

Related Questions

We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10
I have a cell that has date time in the following format. dd/mm/yyyy hh:mm.
I want to match dates that have the following format: 2010-08-27, 2010/08/27 Right now
I have the following date format: 2010-04-15 23:59:59 How would I go about converting
I have the following date format: Tue Mar 06 17:45:35 -0600 2012 and I
I have a date in the following format: 2010-03-01T00:00:00-08:00 I have thrown the following
I have to compare a user entered date, Dt (in mm/dd/yyyy format) with the
I have the following tables: --table sportactivity-- sport_activity_id, home_team_fk, away_team_fk, competition_id_fk, date, time (tuple
I've string (variable is fileDate ) with Date values in the following format: 2/12/2011
I have timezones in the following array format: 'America/New_York' => '(GMT-05:00) Eastern Time (US

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.