Java Month Calculate getNowMonth()

Here you can find the source of getNowMonth()

Description

get Now Month

License

Open Source License

Declaration

@SuppressWarnings("deprecation")
    public static String getNowMonth() 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {
    @SuppressWarnings("deprecation")
    public static String getNowMonth() {
        Date date = new Date();
        int year = date.getYear() + 1900;
        int month = date.getMonth() + 1;
        return year + "-" + (month < 10 ? "0" : "") + month;
    }//from w ww.  j av a2 s.c  om

    @SuppressWarnings("deprecation")
    public static int getMonth(int i) {
        return getCurrentDate().getMonth();
    }

    public static Date getCurrentDate() {
        return new Date(System.currentTimeMillis());
    }
}

Related

  1. getMonthsMap()
  2. getMonthsOfAge(Date birth, Date now)
  3. getMonthSpan(Date begin, Date end)
  4. getNextMonth(long date)
  5. getNextMonthExtention(Date dt, Long n)
  6. getStartOfMonth(Calendar scal)
  7. getThisMonthEnd()
  8. getThisMonthStart()
  9. incrementMonth(long date, int increment)