Java SQL Date Month getNextMonthStartDate(Date date)

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

Description

get Next Month Start Date

License

Open Source License

Declaration

public static Timestamp getNextMonthStartDate(Date date) 

Method Source Code


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

import java.sql.Timestamp;

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

public class Main {

    public static Timestamp getNextMonthStartDate(Date date) {
        Calendar rightNow = Calendar.getInstance();
        rightNow.setTime(date);//from   w  ww .ja va  2 s.com
        rightNow.set(Calendar.DAY_OF_MONTH, 1);
        rightNow.set(Calendar.HOUR_OF_DAY, 0);
        rightNow.set(Calendar.MILLISECOND, 0);
        rightNow.set(Calendar.SECOND, 0);
        rightNow.set(Calendar.MINUTE, 0);
        rightNow.set(Calendar.MONTH, rightNow.get(Calendar.MONTH) + 1);
        return new Timestamp(rightNow.getTimeInMillis());
    }
}

Related

  1. getMonthDays(java.sql.Date date)
  2. getMonthFromYMD(Date ymd)
  3. getMonthStart(Date stamp)
  4. getMulmonthday(String startdate, String enddate)
  5. getNextMonthFirstDate(java.sql.Date date)
  6. getSqlDate(final int iDay, final int iMonth, final int iYear)
  7. getSqlDate(int year, int month, int day)
  8. newDate(Integer year, Integer month, Integer day)
  9. toDate(int year, int month, int day)