Java Calendar Year getYear(Calendar cal)

Here you can find the source of getYear(Calendar cal)

Description

get Year

License

Open Source License

Declaration

public static String getYear(Calendar cal) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {

    public static String getYear(Calendar cal) {
        return String.valueOf(cal.get(Calendar.YEAR));
    }//from www.  j  av  a 2  s. c  om

    public static int getYear(String s) {
        if (s == null || s.length() < 10) {
            return 1970;
        }
        return Integer.parseInt(s.substring(0, 4));
    }
}

Related

  1. getStartOfWeekCalendar(final int year, final int weekOfYear, final Locale locale)
  2. getValidCalendar(int year, int month, int day)
  3. getWeekOfYear(Calendar currentDate)
  4. getWeekOfYear(int startDay, Calendar dt)
  5. getWeekOfYearYear(GregorianCalendar cal)
  6. getYear(Calendar calendar)
  7. getYear(Calendar calendar)
  8. getYear(Calendar calendar)
  9. getYear(Date date, Calendar cal)