Java Calendar Truncate trim(final Calendar cal)

Here you can find the source of trim(final Calendar cal)

Description

This method will trim calendar to day by setting hour,min and sec to zero.

License

Open Source License

Parameter

Parameter Description
cal the calendar object

Declaration

public static void trim(final Calendar cal) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    /**/*from  www  .j  a v  a2s. c  o m*/
     * This method will trim calendar to day by setting hour,min and sec to
     * zero.
     * 
     * @param cal
     *            the calendar object
     */
    public static void trim(final 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. trimCalendar(Calendar cal)
  2. trunc(Calendar calendar)
  3. truncate(Calendar calendar)
  4. truncateCal(final Calendar cal)