Android Yesterday Get getYesterday()

Here you can find the source of getYesterday()

Description

get Yesterday

Declaration

public static Date getYesterday() 

Method Source Code

//package com.java2s;

import java.util.Date;

public class Main {
    public static Date getYesterday() {
        Date today = getToday();//from  www  .  j a  v a2  s  .co  m
        Date yesterday = new Date(today.getYear(), today.getMonth(),
                today.getDate() - 1); //beginning of yesterday
        return yesterday;
    }

    public static Date getToday() {
        Date now = new Date();
        Date today = new Date(now.getYear(), now.getMonth(), now.getDate()); //beginning of today
        return today;
    }
}

Related

  1. getYestoday(String sourceDate, String format)
  2. getYestoday(String sourceDate, String format)
  3. getFormatYestoday(String format)
  4. isYesterday(long date)
  5. getYesterdayFormattedTime()