get Year as String from Calendar - Android java.util

Android examples for java.util:Year

Description

get Year as String from Calendar

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {

    public static String getYear() {
        Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR);
        return String.valueOf(year);
    }/*from w  w w.  j  a v  a 2  s .  c o  m*/
}

Related Tutorials