Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

import java.util.concurrent.TimeUnit;

public class Main {
    /**
     * The number of days from today until the date passed in.
     *
     * @param date The date to count days until.
     * @return The number of days until the date.
     */
    public static long getNumDaysUntilDate(Date date) {
        long msDiff = date.getTime() - Calendar.getInstance().getTimeInMillis();
        return TimeUnit.MILLISECONDS.toDays(msDiff);
    }
}