Java Day of getSignContinusDay(Date lastSignTime)

Here you can find the source of getSignContinusDay(Date lastSignTime)

Description

get Sign Continus Day

License

Apache License

Declaration

public static int getSignContinusDay(Date lastSignTime) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static int getSignContinusDay(Date lastSignTime) {
        Date date = new Date();
        SimpleDateFormat datetr = new SimpleDateFormat("yyyyMMdd");
        String lastSign = datetr.format(lastSignTime);
        String nowDay = datetr.format(date);
        int lastSignDay = Integer.parseInt(lastSign);
        int newDay = Integer.parseInt(nowDay);
        return newDay - lastSignDay;
    }/*from  w  w w. j av  a  2s .  c o m*/

    public static String format(Date date, String pattern) {
        if (date == null) {
            return null;
        }
        SimpleDateFormat sf = new SimpleDateFormat(pattern);
        return sf.format(date);
    }

    public static String format(Date date) {
        return format(date, "yyyy-MM-dd");
    }
}

Related

  1. getOtherDayLastUpdateTimeFormat()
  2. getPaxBirthday()
  3. getPriorDay(int offset, String pattern)
  4. getRunningTime(Date date, SimpleDateFormat sday, String line)
  5. getSetDate(Date dt, int dayNum)
  6. getSpcilNumDayArray(Date startDate, int num)
  7. getSpecifiedDayAfter(String specifiedDay)
  8. getSpecifiedDayAfter(String specifiedDay, int afterDay)
  9. getSpecifiedDayTimeAfter(Date date)