Java Calendar Day getTodayCalendar()

Here you can find the source of getTodayCalendar()

Description

Returns a Java calendar rounded to the current day

License

Open Source License

Return

the calendar

Declaration

public static Calendar getTodayCalendar() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

import java.util.TimeZone;

public class Main {
    private final static TimeZone timeZone = TimeZone.getTimeZone("UTC");

    /**/* ww w  .  j av a  2 s.com*/
     * Returns a Java calendar rounded to the current day
     * @return the calendar
     */
    public static Calendar getTodayCalendar() {
        Calendar calendar = Calendar.getInstance(timeZone);
        calendar.setTimeZone(timeZone);
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar;
    }
}

Related

  1. getRelativeCalendar(int offsetDays)
  2. getSafeTimeForAllDay(Calendar cal)
  3. getStartAndEndOfDay(Calendar calendar)
  4. getStartOfDay(Calendar cal)
  5. getThatMonday(Calendar cal)
  6. getWorkingDay(Calendar beginDate, Calendar endDate)
  7. getWorkingDay(Calendar d1, Calendar d2)
  8. incrementDay(Calendar cal)
  9. incrementOneDay(Calendar calendar)