Java Calendar Truncate truncCalendar(Calendar c)

Here you can find the source of truncCalendar(Calendar c)

Description

truncate the calendar to a day with time 00:00:00.000

License

Open Source License

Declaration

public static void truncCalendar(Calendar c) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:// w ww  .  j  a  va  2 s.com
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/

import java.util.Calendar;

public class Main {
    /**
     * truncate the calendar to a day with time 00:00:00.000
     */
    public static void truncCalendar(Calendar c) {
        c.set(Calendar.HOUR_OF_DAY, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
    }
}

Related

  1. trim(final Calendar cal)
  2. trimCalendar(Calendar cal)
  3. trunc(Calendar calendar)
  4. truncate(Calendar calendar)
  5. truncateCal(final Calendar cal)
  6. truncCalendarToQuarter(Calendar c)