Java Day getDayBetween(String firstDay, String secondDay)

Here you can find the source of getDayBetween(String firstDay, String secondDay)

Description

get Day Between

License

Apache License

Declaration

public static long getDayBetween(String firstDay, String secondDay) 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static long getDayBetween(String firstDay, String secondDay) {
        long dayBetween = 0L;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        try {/*ww  w  .ja v  a2 s .  co m*/
            Date firstDate = simpleDateFormat.parse(firstDay);
            Date secondDate = simpleDateFormat.parse(secondDay);
            dayBetween = (firstDate.getTime() - secondDate.getTime()) / 0x5265c00L;
        } catch (ParseException e) {
            dayBetween = 0L;
            e.printStackTrace();
        }
        return dayBetween;
    }
}

Related

  1. getDay(String tempdat, Locale locale)
  2. getDayAfter(String dateformat, String day, int filed, int delta)
  3. getDayAfterTommorrowsDateFne()
  4. getDayBefore(Date date)
  5. getDayBegin(Date date)
  6. getDayDate(String date, String formatFormat)
  7. getDayDesc(Date arg)
  8. getDayEnd(Date date)
  9. getDayEndTime(int off, String timezone)