Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    public static Date addField(Date date, int field, int amount) {
        Calendar result = getCurrentCalendar(date);
        result.add(field, amount);
        return result.getTime();
    }

    public static final Calendar getCurrentCalendar() {
        return Calendar.getInstance();
    }

    public static final Calendar getCurrentCalendar(Date date) {
        Calendar result = getCurrentCalendar();
        result.setTime(date);
        return result;
    }
}