Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static Date getYesterday(Date from) {
        Calendar c = buildFromDate(from);
        c.add(Calendar.DATE, -1); // number of days to add
        return c.getTime();
    }

    private static Calendar buildFromDate(Date from) {
        Calendar c = Calendar.getInstance();
        c.setTime(from);
        return c;
    }
}