Here you can find the source of getPreDay()
public static String getPreDay()
//package com.java2s; /******************************************************************************* * @(#)DateUtil.java Oct 23, 2007//from www.j av a 2 s .c om * * Copyright 2007 Neusoft Group Ltd. All rights reserved. * Neusoft PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. *******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getPreDay() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_WEEK, -1); Date preTime = calendar.getTime(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); return formatter.format(preTime); } }