Here you can find the source of getYearMonth(String day)
public static String getYearMonth(String day)
//package com.java2s; //License from project: Apache License public class Main { public static String getYearMonth(String day) { if (day == null) return ""; if (day.length() < 8) return ""; int n = day.lastIndexOf("-"); return day.substring(0, n); }// w w w. jav a2s. c o m }