Please find the source code below.
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class test {
public static void main(String[] args) {
String[] temp=new String[2];
String date="2014-02-20 23:20:34";
System.out.println("selected date "+date);
String[] splited=date.split("\\s");
try{
int days=15;
SimpleDateFormat df=new SimpleDateFormat();
Date date1=df.parse((String)df.format(new Date()));
Calendar cal = Calendar.getInstance();
cal.setTime(date1);
SimpleDateFormat hdf = new SimpleDateFormat("dd/MM EEE");
String[] sa=new String[days];
cal.add(Calendar.DAY_OF_MONTH,-1);
for(int i=2;i<days-2;i++) {
cal.add(Calendar.DAY_OF_MONTH,1);
sa[i]=hdf.format(cal.getTime());
System.out.println(sa[i]);
}
}catch(Exception e){
e.printStackTrace();
}
}
}
No comments:
Post a Comment