Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {

    public static void main(String[] args) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat("dd MM yyyy");
        Date dt1 = sdf.parse("22 02 2000");

        Date dt2 = sdf.parse("22 02 2010");

        long diff = dt2.getTime() - dt1.getTime();

        System.out.println("Days: " + diff / 1000L / 60L / 60L / 24L);
    }
}