Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

public class Main {
    public static boolean isYesterday(String dateStr) {
        long curTime = System.currentTimeMillis();
        long yesTime = curTime - 24 * 60 * 60 * 1000;
        Date date = new Date(yesTime);
        SimpleDateFormat dateFormate = new SimpleDateFormat("yyyy-MM-dd", Locale.SIMPLIFIED_CHINESE);
        String str = dateFormate.format(date);
        if (!isEmpty(dateStr) && dateStr.equals(str)) {
            return true;
        }
        return false;
    }

    public static boolean isEmpty(CharSequence string) {
        return string == null || string.length() == 0;
    }
}