Java Date Previous getPreviousDay(Date dateTime)

Here you can find the source of getPreviousDay(Date dateTime)

Description

get Previous Day

License

Apache License

Declaration

public static Date getPreviousDay(Date dateTime) 

Method Source Code

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

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

public class Main {
    public static Date getPreviousDay(Date dateTime) {
        return addDay(dateTime, -1);
    }/* www. j av a 2 s  .  co m*/

    public static Date addDay(Date dateTime, int days) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(dateTime);
        cal.add(Calendar.DAY_OF_MONTH, days);
        return cal.getTime();
    }
}

Related

  1. getPreviousDate(Date date)
  2. getPreviousDate(final Date date)
  3. getPreviousDate(int period)
  4. getPreviousDateStart()
  5. getPreviousDay(Date date)
  6. getPreviousDay(Date inputDate)
  7. getPreviousFriday(final Date d)
  8. getPreviousMonday(Date day)
  9. getPreviousMonth(Date time)