Android Day in Month Get firstDayOfMonth(Date date)

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

Description

first Day Of Month

License

Open Source License

Declaration

public static Date firstDayOfMonth(Date date) 

Method Source Code

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

import java.util.Date;

public class Main {
    public static Date firstDayOfMonth(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);//from w ww  .  j  a  v  a 2s  . c o m
        cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance()
                .getActualMinimum(Calendar.DAY_OF_MONTH));
        cal.set(Calendar.HOUR_OF_DAY, Calendar.getInstance()
                .getActualMinimum(Calendar.HOUR_OF_DAY));
        cal.set(Calendar.MINUTE,
                Calendar.getInstance().getActualMinimum(Calendar.MINUTE));
        return cal.getTime();
    }
}

Related

  1. getStringDayOfMonth(Date date)
  2. getFirstDayOfMonth(String format)
  3. getFirstDayOfMonth(String format)
  4. getLastDayOfMonth(String format)
  5. getLastDayOfMonth(String format)
  6. lastDayOfMonth(Date date)
  7. monthDays(int y, int m)