Java Day in Month currentMonthFirstDay()

Here you can find the source of currentMonthFirstDay()

Description

current Month First Day

License

Open Source License

Declaration

public static String currentMonthFirstDay() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static final String DATE_PATTERN = "yyyy-MM-dd";

    public static String currentMonthFirstDay() {
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN);
        Date curDate = new Date(System.currentTimeMillis());
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(curDate);//ww  w . j  av  a 2  s .c  om
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        return sdf.format(calendar.getTime());
    }
}

Related

  1. dayForMonth(String pTime)
  2. daysInMonth(int month, boolean isLeapYear)
  3. daysInMonth(int month, int year)
  4. daysInMonth(int year, int month)