cancel
Showing results for 
Search instead for 
Did you mean: 

Dispalying future date in a webdynpro Iview

Former Member
0 Kudos

Hello Everyone,

In my web dynpro application after I save details. The saved details should be shows as valid as the monday following the date when details were saved.

Eg

sun 1-mo 2 tue 3 wed 4 thu 5 fri 6 sat 7

The validity date should be mon 9 .

Need your expert suggestions on how to capture the system date and dispalying in valid US format for next monday.

Thanks,

Boiler.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try this to get the next monday from the current date,

SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy");

Date dt = new Date(Calendar.getInstance().getTimeInMillis());

Calendar cal = Calendar.getInstance();

cal.setTime(dt);

cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);

cal.add(Calendar.DATE,7);

dateFormatter.format(dt); // current date

dateFormatter.format(cal.getTime()); // next monday

Regards,

ramesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Following is the sample code



SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy");
		Date dt = new Date(Calendar.getInstance().getTimeInMillis());
		Calendar cal = Calendar.getInstance();
		cal.setFirstDayOfWeek(Calendar.MONDAY);
		cal.setTime(dt);
		cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
		System.out.println(dateFormatter.format(dt)); // Prints current date
		System.out.println(dateFormatter.format(cal.getTime())); // Prints the date of Monday

Regards

Ayyapparaj