Java SQL Date Month getMinDayInMonth(java.sql.Date date)

Here you can find the source of getMinDayInMonth(java.sql.Date date)

Description

get Min Day In Month

License

Apache License

Declaration

public static Timestamp getMinDayInMonth(java.sql.Date date) 

Method Source Code

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

import java.sql.Timestamp;

import java.util.Calendar;

public class Main {

    public static Timestamp getMinDayInMonth(java.sql.Date date) {

        Calendar cale = Calendar.getInstance();
        cale.setTime(date);//from   w w w  .  j a va2 s.  c o m
        cale.set(Calendar.DAY_OF_MONTH,
                cale.getActualMinimum(Calendar.DAY_OF_MONTH));
        java.sql.Date newDate = new java.sql.Date(cale.getTimeInMillis());

        cale = null;
        return Timestamp.valueOf(newDate.toString() + " 00:00:00.000");

    }
}

Related

  1. getFirstDayOfNextMonth(Date date, boolean isFormatDate)
  2. getMonth(Date date)
  3. getMonth(final java.sql.Date date)
  4. getMonthAmount(java.sql.Date _startDate, java.sql.Date _endDate)
  5. getMonthBefroe(Date date)