Java TimeUnit Usage isTheSameDayCheckSummerTime(final Date day1, final Date day2, final boolean escapeYear)

Here you can find the source of isTheSameDayCheckSummerTime(final Date day1, final Date day2, final boolean escapeYear)

Description

is The Same Day Check Summer Time

License

Apache License

Declaration

private static boolean isTheSameDayCheckSummerTime(final Date day1, final Date day2, final boolean escapeYear) 

Method Source Code

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

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

import java.util.concurrent.TimeUnit;

public class Main {
    public static final long DATE = TimeUnit.DAYS.toMillis(1);

    private static boolean isTheSameDayCheckSummerTime(final Date day1, final Date day2, final boolean escapeYear) {
        final Calendar c = Calendar.getInstance();
        c.setTime(day1);//from www.  jav  a2  s. co  m
        final int y = c.get(Calendar.YEAR);
        final int m = c.get(Calendar.MONTH);
        final int d = c.get(Calendar.DATE);
        c.setTime(day2);
        return (escapeYear || y == c.get(Calendar.YEAR)) && m == c.get(Calendar.MONTH) && d == c.get(Calendar.DATE);
    }
}

Related

  1. humanizeTime(long hours, long minutes, long seconds)
  2. humanizeToTime(long millis)
  3. humanReadableDuration(Date from, Date to)
  4. humanReadableMillis(long millis)
  5. isCurrentDateBeforeAndWithinRangeOfDate( Date date, int rangeInDays)
  6. isTimedOut(long start, long timeout)
  7. isValidTTL(final Integer ttlDurationInSeconds)
  8. julianDayToMillis(int julianDay)
  9. logDuration(org.slf4j.Logger log, String prefix, long startTimeNanos)