Java TimeZone hasTimeComponent(Date date, TimeZone timeZone)

Here you can find the source of hasTimeComponent(Date date, TimeZone timeZone)

Description

has Time Component

License

Open Source License

Declaration

public static boolean hasTimeComponent(Date date, TimeZone timeZone) 

Method Source Code


//package com.java2s;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static boolean hasTimeComponent(Date date, TimeZone timeZone) {
        final Calendar cal = Calendar.getInstance();
        cal.setTimeZone(timeZone);//  w  w  w .ja v  a  2 s  .  co m
        cal.setTime(date);
        //Forces the calendar to re-calculate
        cal.getTime();

        // only check hours and minutes
        return (cal.get(Calendar.HOUR_OF_DAY) != 0) || (cal.get(Calendar.MINUTE) != 0);
    }
}

Related

  1. getExcelSerialDayNumber(Date date, Locale locale, TimeZone timeZone)
  2. getLocalTime( java.util.TimeZone localTimeZone, java.util.Date timestamp, java.util.TimeZone sourceTimeZone)
  3. getTimezoneDate(String stateCode)
  4. getTimeZoneOffset(Date d)
  5. getTimezoneOffsetInHours(Date date)
  6. midnight(Date date, TimeZone tz)
  7. monthOfYear(Date referenceDate, int month, TimeZone timeZone)
  8. normalizeDate(Date date, TimeZone timeZone)
  9. startOfNextDay(final Date date, final TimeZone timeZone)