Java Year Get getYear(String startTime)

Here you can find the source of getYear(String startTime)

Description

get Year

License

Open Source License

Declaration

public static int getYear(String startTime) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    public static int getYear(String startTime) {
        int year = 0;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        try {/*from w ww . j ava 2s.  c  o  m*/
            year = sdf.parse(startTime).getYear() + 1900;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return year;
    }
}

Related

  1. getYear(String dateKey)
  2. getYear(String datetime)
  3. getYear(String day)
  4. getYear(String index)
  5. getYear(String referralId)
  6. getYear(String str_date)
  7. getYear(String strDate)
  8. getYear(String strDate)
  9. getYear(String string)