set Start Of Date - Java java.util

Java examples for java.util:Calendar Calculation

Description

set Start Of Date

Demo Code


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

public class Main {
    public static void main(String[] argv) throws Exception {
        Calendar calendar = Calendar.getInstance();
        System.out.println(setStartOfDate(calendar));
    }// w  ww  .j  a v  a 2s.  c  o m

    public static Calendar setStartOfDate(Calendar calendar) {
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar;
    }
}

Related Tutorials