Java Year Month getFirstDayOfMonth(int year, int month)

Here you can find the source of getFirstDayOfMonth(int year, int month)

Description

get First Day Of Month

License

Apache License

Declaration

public static String getFirstDayOfMonth(int year, int month) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {
    public static String getFirstDayOfMonth(int year, int month) {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.MONTH, month);
        cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DATE));
        return new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
    }/* w w w.  j  a v  a2s.  c o  m*/
}

Related

  1. getDate(int year, int month, int day, int hour, int minute)
  2. getDaysOfMonth(String year, String month)
  3. getEndDateOfMonth(int year, int month)
  4. getFirstDay(String yearMonthStr, int range)
  5. getFirstDayByMonthWeek(int year, int month, int week)
  6. getFirstDayOfMonth(int year, int month, Integer day)
  7. getFirstTimeOfDay(int year, int month, int day)
  8. getFirstYearMonth()
  9. getMonthDays(Integer year, Integer month)