Here you can find the source of getCurrCustomMinuteDate(String formatStr, int changeMinute)
public static String getCurrCustomMinuteDate(String formatStr, int changeMinute)
//package com.java2s; /*//from w w w . jav a2 s .co m * Copyright 1998-2012 360buy.com All right reserved. This software is the confidential and proprietary information of * 360buy.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only * in accordance with the terms of the license agreement you entered into with 360buy.com. */ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static String getCurrCustomMinuteDate(String formatStr, int changeMinute) { Calendar cal = new GregorianCalendar(); cal.setTime(getCurrDate()); cal.add(Calendar.MINUTE, changeMinute); return dateToStr(cal.getTime(), formatStr); } public static Date getCurrDate() { return new Date(); } public static String getCurrDate(String formatStr) { return dateToStr(getCurrDate(), formatStr); } public static String dateToStr(Date date, String formatStr) { String result = null; if (date != null) { SimpleDateFormat sdf = new SimpleDateFormat(formatStr); result = sdf.format(date); } return result; } }