Here you can find the source of getTimeNextMonthFirstSec(Timestamp sysDate)
public static Timestamp getTimeNextMonthFirstSec(Timestamp sysDate)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.util.Calendar; public class Main { public static Timestamp getTimeNextMonthFirstSec(Timestamp sysDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(sysDate);/*from w ww . jav a 2s . c o m*/ calendar.add(Calendar.MONTH, 1); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.SECOND, 0); return new Timestamp(calendar.getTimeInMillis()); } }