Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset
Comments Off on Java: Find the difference between two dates

Java: Find the difference between two dates

Java: compute the difference between two dates
{filelink=754}

import java.util.*;
public class DifferenceDate
{
        public static void main(String[] av) {
                Date date1 = new GregorianCalendar(2011,11,31,23,59).getTime( );
                Date today = new Date( );
                // Compute difference
                long diff = today.getTime( ) - date1.getTime( );
                System.out.println("Difference  between "+date1+ " and " + today +
                        " is" + (diff / (1000*60*60*24)) + " day(s).");
        }
}

Users who found this page were searching for:

  • java find a thread by name
  • python read a user input
  • Python3: how to compile program to bytecode?
  • python searching in list of dictionaries
  • public class datetime {public static void main(string[] args) {date date1 = new date();system.out.println(date1.gettime());}}
  • python compare string

Comments are closed.