Android Day in Month Get getFirstDayOfMonth(String format)

Here you can find the source of getFirstDayOfMonth(String format)

Description

get First Day Of Month

Declaration

public static String getFirstDayOfMonth(String format) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {

    public static String getFirstDayOfMonth(String format) {
        String strDate = null;/*  w ww.  j  av a 2 s .c  o m*/
        try {
            Calendar c = new GregorianCalendar();
            SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat(
                    format);
            //????????
            c.set(GregorianCalendar.DAY_OF_MONTH, 1);
            strDate = mSimpleDateFormat.format(c.getTime());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return strDate;

    }
}

Related

  1. perMonthDays(Calendar cal)
  2. numDaysToEndOfMonth()
  3. dayNumber(Date date)
  4. getDayOfWeek(long time)
  5. getStringDayOfMonth(Date date)
  6. getFirstDayOfMonth(String format)
  7. getLastDayOfMonth(String format)
  8. getLastDayOfMonth(String format)
  9. firstDayOfMonth(Date date)