Android Month Date Get getStartCurrentMonth()

Here you can find the source of getStartCurrentMonth()

Description

get Start Current Month

Declaration

public static long getStartCurrentMonth() 

Method Source Code

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

public class Main {
    public static long getStartCurrentMonth() {
        return getStartCurrentMonthCal().getTimeInMillis();
    }/*from  w  ww  . j av a 2 s. c  om*/

    public static Calendar getStartCurrentMonthCal() {
        Calendar calendar = getCalendar();
        calendar.set(Calendar.DAY_OF_MONTH,
                calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);

        return calendar;
    }

    private static Calendar getCalendar() {
        Calendar calendar = GregorianCalendar.getInstance();
        calendar.setTime(new Date());
        return calendar;
    }
}

Related

  1. getStringMonth(Date date)
  2. getMonth(int month, Locale locale)
  3. getMonthName(String substring)
  4. getEndCurrentMonth()
  5. getEndCurrentMonthCal()
  6. getStartCurrentMonthCal()