Here you can find the source of getDiffToString(Date date, int n, String pattern)
public static String getDiffToString(Date date, int n, String pattern)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getDiffToString(Date date, int n, String pattern) { Date returnDay = new Date(date.getTime() + n * 24 * 3600 * 1000L); SimpleDateFormat df = new SimpleDateFormat(pattern); return df.format(returnDay); }/*from w w w .j av a 2 s.c o m*/ }