get Today Midnight - Java java.util

Java examples for java.util:Day

Description

get Today Midnight

Demo Code


//package com.java2s;
import java.util.Calendar;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getTodayMidnight());
    }//from   www  .  jav  a  2 s . c o  m

    public static Calendar getTodayMidnight() {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal;
    }
}

Related Tutorials