Java Month Convert nextMonth(Date date)

Here you can find the source of nextMonth(Date date)

Description

next Month

License

Apache License

Declaration

public static Date nextMonth(Date date) 

Method Source Code


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

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Date nextMonth(Date date) {
        Calendar c = new GregorianCalendar();
        c.setTime(date);/*w  w w. j  ava  2  s  .  c  om*/
        c.add(Calendar.MONTH, 1);
        return c.getTime();
    }

    public static long getTime(String s) {
        return parseMysql(s).getTime();
    }

    public static Date parseMysql(String s) {
        try {
            DateFormat fmtTemp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return fmtTemp.parse(s);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. monthNumber(String s)
  2. monthOfDate(Date s)
  3. monthsBetween(String from, String to)
  4. monthStringToInt(String month)
  5. nextMonth()
  6. nextMonth(Date date)
  7. parseMonth(final String source)
  8. setMonths(Date date, int amount)