Java Timestamp isDifferentDay(final Timestamp ts1, final Timestamp ts2)

Here you can find the source of isDifferentDay(final Timestamp ts1, final Timestamp ts2)

Description

is Different Day

License

Open Source License

Declaration

public static boolean isDifferentDay(final Timestamp ts1, final Timestamp ts2) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;

import java.util.Calendar;

public class Main {
    public static boolean isDifferentDay(final Timestamp ts1, final Timestamp ts2) {
        final Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(ts1.getTime());
        final int day1 = cal.get(Calendar.DAY_OF_MONTH), month1 = cal.get(Calendar.MONTH),
                year1 = cal.get(Calendar.YEAR);
        cal.setTimeInMillis(ts2.getTime());
        final int day2 = cal.get(Calendar.DAY_OF_MONTH), month2 = cal.get(Calendar.MONTH),
                year2 = cal.get(Calendar.YEAR);
        return (day1 != day2 || month1 != month2 || year1 != year2);

    }/*from   w w  w .  ja v a2  s.co  m*/
}

Related

  1. getZonedDateTime(final Timestamp timestamp)
  2. hasTimeExpired(Timestamp referenceTime)
  3. inRange(Timestamp start, Timestamp end, boolean OnMonday, boolean OnTuesday, boolean OnWednesday, boolean OnThursday, boolean OnFriday, boolean OnSaturday, boolean OnSunday)
  4. internalToTimestamp(long v)
  5. isAllDay(Timestamp start, Timestamp end)
  6. isDST(Timestamp ts)
  7. isInPast(Timestamp timeStamp)
  8. isLongDate(Timestamp date)
  9. isLongTerm(Timestamp oldTime, Timestamp newTime)