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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:22:19+00:00 2026-06-02T02:22:19+00:00

In my android app, i am getting date and time in following format via

  • 0

In my android app, i am getting date and time in following format via HTTP request.

Tue Apr 17 16:23:33 IST 2012

Now i want to calculate the time difference between that time and current time.I have got lot of ways to calculate time difference in the internet but all those solutions are with different formats.How can i calculate time difference with above time format?

Edit:
This is the code i used its working fine.

  DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
  Date dateOne = df.parse("Tue apr 22 13:07:32 IST 2012");
  Date dateTwo = df.parse("Tue Apr 22 13:07:33 IST 2012");   
  long timeDiff = Math.abs(dateOne.getTime() - dateTwo.getTime());
  System.out.println("difference:" + timeDiff); //differencs in ms

but i have to take current time in format “Tue apr 22 13:07:32 IST 2012” to use as dateTwo.

  • 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-06-02T02:22:20+00:00Added an answer on June 2, 2026 at 2:22 am

    you can also this code:::

    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
    Date dateOne = df.parse("2011-02-08 10:00:00 +0300");
    Date dateTwo = df.parse("2011-02-08 08:00:00 +0100");   
    long timeDiff = Math.abs(dateOne.getTime() - dateTwo.getTime());
    System.out.println("difference:" + timeDiff);   // difference: 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android app that is getting fairly large and complex now, and
While building the android app using ant am getting the following exception. Couldn't figure
A while back, my android map app stopped getting Google Satellite tiles. Now that
I'm getting a class cast exception namely java.lang.ClassCastException: android.app.Application cannot be cast to greendroid.app.GDApplication
I'm working on an Android app native written in java and I'm getting a
I am developing a Android app using Jquery Mobile/Phonegap. I have the following code
The Activity Lifecycle is giving me headaches. The documentation at http://developer.android.com/reference/android/app/Activity.html is so darn
I'm building a calander app for Android in appcelerator, but now I'm having some
I'm getting weird problems in my android app and I think it may be
I have an older 2.x Android app that I am finally getting around to

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.