Here you can find the source of getYear(String str_date)
public static String getYear(String str_date)
//package com.java2s; /**/*from ww w . j a v a 2 s.c om*/ * Copyright (C) 2002-2005 WUZEWEN. All rights reserved. * WUZEWEN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { public static String getYear(String str_date) { return getYear(str_date, "-"); } public static String getYear(String str_date, String sep) { return str_date.substring(0, str_date.indexOf(sep)); } }