Here you can find the source of setCalendarHourMinSec(final Calendar originalCalendar, final int hourOfDay, final int minute, final int second)
Parameter | Description |
---|---|
originalCalendar | The original calendar. |
hourOfDay | The hour of the day to set. |
minute | The minute to set. |
second | The second to set. |
public static Calendar setCalendarHourMinSec(final Calendar originalCalendar, final int hourOfDay, final int minute, final int second)
//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; } }