Java Calendar Minute setCalendarHourMinSec(final Calendar originalCalendar, final int hourOfDay, final int minute, final int second)

Here you can find the source of setCalendarHourMinSec(final Calendar originalCalendar, final int hourOfDay, final int minute, final int second)

Description

Set the calendar hour, minute and second value.

License

Open Source License

Parameter

Parameter Description
originalCalendar The original calendar.
hourOfDay The hour of the day to set.
minute The minute to set.
second The second to set.

Return

The new calendar object.

Declaration

public static Calendar setCalendarHourMinSec(final Calendar originalCalendar, final int hourOfDay,
        final int minute, final int second) 

Method Source Code

//package com.java2s;
/*//from   ww w  . j  a v a2  s  . co  m
 * Copyright (c) 2013, Everit Kft.
 *
 * All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301  USA
 */

import java.util.Calendar;

public class Main {
    /**
     * Set the calendar hour, minute and second value.
     * 
     * @param originalCalendar
     *            The original calendar.
     * @param hourOfDay
     *            The hour of the day to set.
     * @param minute
     *            The minute to set.
     * @param second
     *            The second to set.
     * @return The new calendar object.
     */
    public static Calendar setCalendarHourMinSec(final Calendar originalCalendar, final int hourOfDay,
            final int minute, final int second) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(originalCalendar.get(Calendar.YEAR), originalCalendar.get(Calendar.MONTH),
                originalCalendar.get(Calendar.DAY_OF_MONTH), hourOfDay, minute, second);
        return calendar;
    }
}

Related

  1. getMinutesInterval(Calendar start, Calendar end)
  2. getOffsetInMinutes(Calendar cal)
  3. isNow(Calendar cal, Locale locale, boolean minuteCheck)
  4. minuteFloor(Calendar calendar)
  5. roundByMinutes(Calendar cal, int interval)
  6. setCalendarTime(Calendar calendar, int hour, int minute, int second, int millis)
  7. setMinutes(int i, Calendar calendar)
  8. setTime(Calendar calendar, int hourOfDay, int minute, int second, int millisecond)
  9. setToTime(Calendar calendar, int hours, int minutes)