Java Date to Month getMonthlyKey(Date d)

Here you can find the source of getMonthlyKey(Date d)

Description

get Monthly Key

License

Apache License

Declaration

public static String getMonthlyKey(Date d) 

Method Source Code


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

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

public class Main {
    public static String getMonthlyKey(Date d) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);//from   w w  w  .j a v  a2 s . c o  m

        int month = c.get(Calendar.MONTH) + 1;

        return c.get(Calendar.YEAR) + "_" + (month < 10 ? "0" : "") + month;
    }
}

Related

  1. getMonthFirstDay(Date date)
  2. getMonthFromDate(Date date)
  3. getMonthInterval(Date _one, Date _two)
  4. getMonthLastDate(Date date)
  5. getMonthLastDay(Date date)
  6. getMonthName(Date date)
  7. getMonthOfCurrentTime(Date date)
  8. getMonthOffset(Date sourceDate, Date targetDate)
  9. getMonthOfThisYear(Date currentdate)