Showing posts with label Add Days to Date in OAF. Show all posts
Showing posts with label Add Days to Date in OAF. Show all posts

Sunday, April 17, 2011

Add Days to Date in OAF

 
import oracle.jbo.domain.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;

String initDate =selectedRows.getAttribute("InitDate")+"";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
String tatDate=null;
try
{
c.setTime(sdf.parse(initDate));
c.add(Calendar.DATE, 1); // number of days to add
tatDate = sdf.format(c.getTime()); // dt is now the new date
System.out.println("New Date : "+tatDate);
}
catch (ParseException e)
{
throw new IllegalArgumentException("Encountered Date format error "+ e);
}