Java SQL Date Get getDateNextMonth(java.util.Date current)

Here you can find the source of getDateNextMonth(java.util.Date current)

Description

get Date Next Month

License

Open Source License

Declaration

static public java.util.Date getDateNextMonth(java.util.Date current) 

Method Source Code


//package com.java2s;
import java.sql.*;
import java.util.Calendar;

public class Main {
    static public java.util.Date getDateNextMonth(java.util.Date current) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(current);/*w w w  .ja va 2  s.c om*/
        Date retVal = null;

        // Make sure it is not December
        if (cal.get(Calendar.MONTH) == Calendar.DECEMBER) {
            cal.set(Calendar.MONTH, Calendar.JANUARY);
        } else {
            cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + 1);
        }

        retVal = new Date(cal.getTimeInMillis());
        return retVal;
    }
}

Related

  1. getDateFromRTGSDateString(String iobDate)
  2. getDateFromTimestamp(Timestamp timestamp)
  3. getDateFromYMD(Date ymd)
  4. getDateInput(String prompt)
  5. getDateISO(final String sDate)
  6. getDateOfShortStr(String dateStr)
  7. getDateOfString(long time, String patten)
  8. getDateOrTime(int colType, Object o)
  9. getDateParameter(java.sql.Date date, int param)