Java Year From getYearFromYM(String ym)

Here you can find the source of getYearFromYM(String ym)

Description

get Year From YM

License

Open Source License

Declaration

public static String getYearFromYM(String ym) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String DEFAULT_DATE_YM_FORMAT = "yyyyMM";

    public static String getYearFromYM(String ym) {

        if (ym == null || ym.length() != DEFAULT_DATE_YM_FORMAT.length()) {
            return null;
        }/*w  w w  . ja v  a 2 s .  c om*/

        return ym.substring(0, 4);
    }
}

Related

  1. getYearFormat(String dateString)
  2. getYearFromDay(int days)
  3. getYearFromISODate(String isoDate)
  4. getYearFromTimestamp(long ms)
  5. getYearFromWeekCode(String weekCode)
  6. getYearMonth(String day)
  7. getYearMonthArray(Integer yearMonth)
  8. getYearMonthDays(int year, int month)
  9. getYearNumberofdays(String date)