Java Calendar Day todayCalendar()

Here you can find the source of todayCalendar()

Description

today Calendar

License

Open Source License

Declaration

public static Calendar todayCalendar() 

Method Source Code

//package com.java2s;
// The MIT License (MIT)

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    public static Calendar todayCalendar() {
        Calendar cal = new GregorianCalendar();
        clearTime(cal);/*from  w  ww  .  ja  v a2 s . c  o m*/
        return cal;
    }

    public static java.util.Date clearTime(java.util.Date d) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(d);

        clearTime(cal);
        return cal.getTime();
    }

    public static void clearTime(Calendar cal) {
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
    }
}

Related

  1. setToBeginningOfDay(Calendar cal)
  2. setToStartOfDay(Calendar start)
  3. setToStartTimeOfTheDay(Calendar c)
  4. startOfDay(Calendar calendar)
  5. toCountWorkDays(GregorianCalendar start, GregorianCalendar end)
  6. toEndOfDayCalendar(Date date)
  7. toNextWorkDay(Calendar cal)
  8. trimToDay(Calendar calendar)
  9. truncateDay(Calendar calendar)