Java Calendar Time hasTime(Calendar cal)

Here you can find the source of hasTime(Calendar cal)

Description

Method to check whether hour, minute, second and millisecond fields are set

License

Apache License

Parameter

Parameter Description
cal calendar to check

Return

true if we have a time

Declaration

public static boolean hasTime(Calendar cal) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    /**/*from www  .j  a v  a  2  s  . c om*/
     * Method to check whether hour, minute, second and millisecond fields are set
     * 
     * @param cal calendar to check
     * @return true if we have a time
     */
    public static boolean hasTime(Calendar cal) {
        boolean hasTime = cal.isSet(Calendar.HOUR_OF_DAY) && cal.isSet(Calendar.MINUTE)
                && cal.isSet(Calendar.SECOND) && cal.isSet(Calendar.MILLISECOND);
        return hasTime;
    }
}

Related

  1. getTimeValue(Calendar cal)
  2. getTimeYYYYMMDD(Calendar calendar)
  3. getTimeZone(Calendar cal)
  4. getTimeZoneCalendar(final TimeZone timeZone)
  5. getTimezoneString(Calendar cal)
  6. hasTimePart(Calendar calendar)
  7. isEquals(Calendar startTime, Calendar timeCurrent, int type)
  8. isFirstMorning(Calendar time, Calendar previous)
  9. isFuture(Calendar time)