Android examples for java.util:Year
get Current Year
import android.text.format.Time; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main{ public static int getNowYear() { Time time = new Time("GMT+8"); time.setToNow();// www. ja v a 2 s. com int year = time.year; return year; } }