Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Date;

import java.util.concurrent.TimeUnit;

public class Main {
    public static int daysUntil(Date date) {
        return daysBetween(new Date(System.currentTimeMillis()), date);
    }

    public static int daysBetween(Date date1, Date date2) {
        long timespan = date2.getTime() - date1.getTime();
        return (int) TimeUnit.DAYS.convert(timespan, TimeUnit.MILLISECONDS);
    }
}