Java Month Day getFirstDateOfCurMonth()

Here you can find the source of getFirstDateOfCurMonth()

Description

get First Date Of Cur Month

License

Open Source License

Declaration

public static String getFirstDateOfCurMonth() 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

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

    public static String getFirstDateOfCurMonth() {
        String curYearMonth = getCurYearMonth();
        return curYearMonth + "-01";
    }/*from w w  w . ja va  2s  .  c  om*/

    public static String getCurYearMonth() {
        String curTime = getCurDate();
        String curYearMonth = curTime.substring(0, 7);
        return curYearMonth;
    }

    public static String getCurDate() {
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat(date_pattern);
        return format.format(date);
    }

    public static String getCurDate(String fmt) {
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat(fmt);
        return format.format(date);
    }
}

Related

  1. getDayOfMonth()
  2. getDaysInMonth(final Date date)
  3. getDaysOfMonth(Date date)
  4. getDaysOfMonth(Date date)
  5. getFirstDate(String base_month)
  6. getFirstDateOfMonth(Date theDate)
  7. getFirstday_Month(Date date, int months)
  8. getFirstDayOfCurMonth()
  9. getFirstDayOfCurrentMonth()