Here you can find the source of getOffsetDate(Date protoDate, int dayOffset)
Parameter | Description |
---|---|
protoDate | a parameter |
dayOffset | a parameter |
public static Date getOffsetDate(Date protoDate, int dayOffset)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { /**/*from ww w . j a v a2 s. com*/ * * @param protoDate * @param dayOffset * @return */ public static Date getOffsetDate(Date protoDate, int dayOffset) { Calendar cal = Calendar.getInstance(); cal.setTime(protoDate); cal.add(Calendar.DATE, -dayOffset); return cal.getTime(); } public static String getTime(String pattern) { return new SimpleDateFormat(pattern).format(new Date()); } }