Java Year Format formatMonth(int timeInfo, String yearInfo)

Here you can find the source of formatMonth(int timeInfo, String yearInfo)

Description

format Month

License

Open Source License

Declaration

private static String formatMonth(int timeInfo, String yearInfo) 

Method Source Code


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

import java.text.SimpleDateFormat;

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

public class Main {
    private static String formatMonth(int timeInfo, String yearInfo) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.set(Calendar.MONTH, timeInfo - 1);
        cal.set(Calendar.YEAR, Integer.parseInt(yearInfo));
        SimpleDateFormat formatter = new SimpleDateFormat("MMM-yyyy");
        return formatter.format(cal.getTime());
    }/*from  ww w .  ja  va 2  s  . com*/
}

Related

  1. format_D_MM_YYYY_HH_MM(Date date)
  2. formateDate2yyyyMMdd()
  3. formatInyyyyMMdd(java.util.Date date)
  4. formatMdDdYySlashed(Date date)
  5. formatMmDdYyyy(final Date date)
  6. formatNanosYearGMT(long nanos)
  7. formatSlashedMmDdYy()
  8. formatTimeStampYearFirst(Date date)
  9. formatUniversalMonthYear(Date date)