Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.Calendar;

public class Main {

    @SuppressWarnings({ "static-access" })
    public static String getFutureMonthDay(String iFuntureMonth, String sBirthDay) {
        if (!"".equals(iFuntureMonth) && !"".equals(sBirthDay)) {
            Calendar cal = Calendar.getInstance();
            cal.set(Integer.parseInt(sBirthDay.substring(0, 4)), Integer.parseInt(sBirthDay.substring(5, 7)) - 1,
                    Integer.parseInt(sBirthDay.substring(8, 10)));
            cal.add(cal.MONTH, Integer.parseInt(iFuntureMonth));
            return cal.get(cal.YEAR) + "/" + String.format("%02d", (cal.get(cal.MONTH) + 1)) + "/"
                    + String.format("%02d", cal.get(cal.DATE));
        } else {
            return "";
        }
    }
}