Here you can find the source of getDisplayDate(final Date date, final int offsetDays)
public static String getDisplayDate(final Date date, final int offsetDays)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final DateFormat DISPLAY_FORMAT = new SimpleDateFormat("E : dd-MMM"); public static String getDisplayDate(final Date date, final int offsetDays) { String val = null; if (date != null) { Date offsetDate = date; if (offsetDays > 0) { offsetDate = getDateAfter(date, offsetDays); }//from w w w. j a v a 2 s. c om val = DISPLAY_FORMAT.format(offsetDate); } return val; } public static Date getDateAfter(Date date, int increment) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calendar.add(Calendar.DAY_OF_YEAR, increment); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); } }