Java Calendar Millisecond setCalendarTime(Calendar inCalendar, int hr, int min, int sec, int milliSec)

Here you can find the source of setCalendarTime(Calendar inCalendar, int hr, int min, int sec, int milliSec)

Description

Call this function to set the time section of a calendar

License

Open Source License

Parameter

Parameter Description
inCalendar a parameter
hr a parameter
min a parameter
sec a parameter
milliSec a parameter

Declaration

public static void setCalendarTime(Calendar inCalendar, int hr, int min, int sec, int milliSec) 

Method Source Code

//package com.java2s;
/*/* ww  w .j a va  2 s.c  o  m*/
* @(#)Utility.java
*
* Copyright (c) 2003 DCIVision Ltd
* All rights reserved.
*
* This software is the confidential and proprietary information of DCIVision
* Ltd ("Confidential Information").  You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the license
* agreement you entered into with DCIVision Ltd.
 */

import java.util.Calendar;

public class Main {
    /**
     * Call this function to set the time section of a calendar
     *
     * @param inCalendar
     * @param hr
     * @param min
     * @param sec
     * @param milliSec
     */
    public static void setCalendarTime(Calendar inCalendar, int hr, int min, int sec, int milliSec) {
        if (inCalendar != null) {
            if (hr != -1) {
                inCalendar.set(Calendar.HOUR_OF_DAY, hr);
            }
            if (min != -1) {
                inCalendar.set(Calendar.MINUTE, min);
            }
            if (sec != -1) {
                inCalendar.set(Calendar.SECOND, sec);
            }
            if (milliSec != -1) {
                inCalendar.set(Calendar.MILLISECOND, milliSec);
            }
        }
    }
}

Related

  1. getMilliSinceMidnight(Calendar arg)
  2. hasZeroMilliSeconds(Calendar cal)
  3. newCalendar(long timeInMillis)
  4. setCalendar(Calendar calendar, int wholeDays, int millisecondsInDay, boolean use1904windowing)
  5. setCalendar(Calendar calendar, int wholeDays, int millisecondsInDay, boolean use1904windowing, boolean roundSeconds)
  6. setTimeInMillis(Calendar _calendar, long _timemillis)
  7. toCalendar(final long millis)
  8. toCalendar(long millis)
  9. toStringDateTimeMillisecond(Calendar calendar)