Here you can find the source of getyesterday(String today)
public static String getyesterday(String today)
//package com.java2s; public class Main { public static String getyesterday(String today) { String subYear = today.substring(0, 4); String subMonth = today.substring(5, 7); String subDay = today.substring(8, 10); Long LongDay = new Long(subDay); long longDay = LongDay.longValue(); if (longDay != 1) { longDay--;//from w ww . j av a2s.c om } String yesterday; if (longDay < 10) { yesterday = subYear + "-" + subMonth + "-" + "0" + longDay; } else { yesterday = subYear + "-" + subMonth + "-" + longDay; } return yesterday; } }