Here you can find the source of toStringYearMonth(Calendar calendar)
Parameter | Description |
---|---|
calendar | a parameter |
public static String toStringYearMonth(Calendar calendar)
//package com.java2s; /*/*from ww w .j av a 2 s . co m*/ * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Calendar; public class Main { private static final int BUDDHIST_YEAR = 543; /** * @param calendar * @return String ("201301") * @example String yearMonth = DateUtils.convertCalendarToStringyearmonth( * DateUtils.getCurrentDateCalendarEng() ); */ public static String toStringYearMonth(Calendar calendar) { String yyyy = String.valueOf(calendar.get(Calendar.YEAR) + BUDDHIST_YEAR); String mm = String.valueOf(calendar.get(Calendar.MONTH) + 1); if (mm.length() < 2) { mm = "0" + mm; } return yyyy + mm; } }