Here you can find the source of getLastyearToday(String str)
public static String getLastyearToday(String str)
//package com.java2s; public class Main { public static String lastYearToday; public static String getLastyearToday(String str) { String subYear = str.substring(0, 4); String subMonth = str.substring(5, 7); String subDay = str.substring(8, 10); Long LongYear = new Long(subYear); long longYear = LongYear.longValue(); longYear--;// w w w. ja v a 2 s. co m lastYearToday = longYear + "-" + subMonth + "-" + subDay; return lastYearToday; } }