Java Utililty Methods Year Get

List of utility methods to do Year Get

Description

The list of methods to do Year Get are organized into topic(s).

Method

StringgetYear()
get Year
GregorianCalendar calendar = new GregorianCalendar();
String year = new Integer(calendar.get(GregorianCalendar.YEAR)).toString();
return year;
StringgetYear()
get Year
return sdfYear.format(new Date());
StringgetYear()
get Year
String str = "";
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
final Date date = new Date();
str = sdf.format(date);
return str;
intgetYear()
get Year
Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.YEAR);
intgetYear()
get Year
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(getDate());
return calendar.get(Calendar.YEAR);
StringgetYear()
get Year
Date date = new Date();
SimpleDateFormat formatter;
String pattern = "yyyy";
formatter = new SimpleDateFormat(pattern, new Locale("ko", "KOREA"));
return formatter.format(date);
intgetYear()
get Year
Calendar mycd = Calendar.getInstance();
return mycd.get(Calendar.YEAR);
StringgetYear()
get Year
return format(getCurrDate(), YYYY);
StringgetYear()
get Year
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
String DATE_FORMAT = "yyyy";
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
sdf.setTimeZone(TimeZone.getDefault());
String now = sdf.format(cal.getTime());
return now;
StringgetYear()
get Year
return format(getCurrDate(), YYYY);