Get current month as String - Android java.util

Android examples for java.util:Month

Description

Get current month as String

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    /**/*w  w w .j  a v a 2s  . c  om*/
     * Get current month
     * @return month in String format
     */
    public static String currentMonth() {
        Calendar cal = Calendar.getInstance();
        int month = cal.get(Calendar.MONTH) + 1;
        return String.valueOf(month);
    }
}

Related Tutorials