Here you can find the source of getWeatherDateStr(int day)
public static String getWeatherDateStr(int day)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private static final String WEATHER_DATE_FORMAT = "MM-dd"; public static String getWeatherDateStr(int day) { Calendar calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat( WEATHER_DATE_FORMAT);//from w w w. j av a 2 s.co m if (day == 0) { return dateFormat.format(calendar.getTime()); } else { calendar.roll(Calendar.DAY_OF_YEAR, day); return dateFormat.format(calendar.getTime()); } } }