Java Month Format getCurrMonthFirstDaySlashFormat()

Here you can find the source of getCurrMonthFirstDaySlashFormat()

Description

get Curr Month First Day Slash Format

License

Open Source License

Declaration

public static String getCurrMonthFirstDaySlashFormat() 

Method Source Code


//package com.java2s;

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static final String dateSlashFormat = "yyyy/MM/dd";

    public static String getCurrMonthFirstDaySlashFormat() {
        Calendar calendar = Calendar.getInstance();
        Date d = new Date();
        calendar.setTime(d);/*from ww w.  jav  a 2  s . c  o m*/
        calendar.set(Calendar.DATE, 1);
        return dateSlashFormat(calendar.getTime());
    }

    public static final String dateSlashFormat(Date date) {
        if (date == null) {
            return "";
        }
        return getFormat(dateSlashFormat).format(date);
    }

    public static final String format(Date date, String formate) {
        if (date == null) {
            return "";
        }
        return getFormat(formate).format(date);
    }

    public static final String format(Long dateTmie, String formate) {
        Date date = new Date(dateTmie);
        return getFormat(formate).format(date);
    }

    public static final DateFormat getFormat(String format) {
        return new SimpleDateFormat(format);
    }
}

Related

  1. formatMonth(int month, Locale locale, boolean longFormat)
  2. formatMonth(String dateOrign)
  3. formatMonthDay(int decimal)
  4. formatMonthlyPeriod(String month)
  5. getAfterByNMonth(String format, int months)
  6. getDisplayMonth(Date time, int monthBefore, int monthAfter, SimpleDateFormat format)
  7. getFirstDayOfNextMonth(String dateFormat)
  8. getFormatCurMonthAsYYYYMM()
  9. getLastYearMonthYYYYMM()