Java Month Get getThisMonth()

Here you can find the source of getThisMonth()

Description

get This Month

License

Apache License

Declaration

public static String getThisMonth() 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

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

    public static String getThisMonth() {

        String dateString = "";

        java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(
                "MM");
        java.util.Date currentTime_1 = new java.util.Date();
        dateString = formatter.format(currentTime_1);

        return dateString;
    }/*from   w ww.j a v  a 2 s .  c o  m*/

    public static String format(Date date) {
        return date == null ? "" : format(date, getDatePattern());
    }

    public static String format(Date date, String pattern) {
        return date == null ? "" : new SimpleDateFormat(pattern)
                .format(date);
    }

    public static String getDatePattern() {
        return defaultDatePattern;
    }
}

Related

  1. getShortMonthForInt(final Locale locale, int theMonth)
  2. getSpecficMonthStart(Date date, int amount)
  3. getStartDateOfMonth(String yyyymm)
  4. getStrOfNextMonth(String dateStr)
  5. getStrThisMonth()
  6. getThisMonth()
  7. getThisMonth()
  8. getThisMonthAndCycle()
  9. getThisMonthDate()