Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.Calendar;
import java.util.Locale;

public class Main {
    public static boolean isYesterday(Calendar cal) {

        Calendar yesterday = Calendar.getInstance(Locale.getDefault());
        yesterday.roll(Calendar.DAY_OF_YEAR, false);

        return cal.get(Calendar.DAY_OF_YEAR) == yesterday.get(Calendar.DAY_OF_YEAR)
                && cal.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR);
    }
}