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

  • Home
  • SEARCH
  • 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 7948815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:49:52+00:00 2026-06-04T01:49:52+00:00

I have a code that has 2 dates in the format DateFormat dateFormat= new

  • 0

I have a code that has 2 dates in the format

DateFormat dateFormat= new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
           Date date=new Date();

           DateFormat formatter ; 
           Date publishDate = (Date)dateFormat.parse(pubDate);  

I want to calculate days between two dates. I can’t use Joda package. Is there any way to get the day difference in the 2 dates ?

  • 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-04T01:49:54+00:00Added an answer on June 4, 2026 at 1:49 am
    
    Date d1 = ..., d2 = ...;
    long t1 = d1.getTime(),
       t2 = d2.getTime();
    long day = 1000 * 60 * 60 * 24; // milliseconds in a day
    return (t1 - t2) / day;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have old code that uses new Date(dateString) to parse a date string. Compiling
I have a string that has a date format of HH:mm so for example
I have this code that has one button that let's me choose an entry
I have a code base that has been used as an ASP.Net web application.
I have some older (broken) code that has a join using a *= table1.ID
I have a simple jQuery code that runs on a web page that has
I have written a PHP function to take a video embed code that has
I have a chart (code to replicate will be below) that has two lines
We have a Japanese client that has source code in COBOL on an mainframe.
We have a sub-project 'commonUtils' that has many generic code-snippets used across the parent

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.