Add the specified number of weekdays to this date.
Syntax
public DtpDate addWeekdays(int numberOfWeekdays)
Parameters
Return values
A new DtpDate object.
Exceptions
DtpDateException
Notes
The addWeekdays() method adds the specified number of weekdays to this date. You can then use the get methods to retrieve the information of the resulting new date. The DtpDate returned will inherit all the properties of the current instance of DtpDate, such as month names, date format, and so on.
Only Monday, Tuesday, Wednesday, Thursday, and Friday, or the equivalent values, are considered to be weekdays. Monday is considered to be the first day of the week.
Examples
try { DtpDate toDay = new DtpDate("8/2/1999 00:00:00", "M/D/Y h:m:s"); DtpDate fiveWeekdaysLater = toDay.addWeekdays(5); // The new date should be 8/9/1999 00:00:00 System.out.println("Next month is " + fiveWeekdaysLater.getDayOfMonth() + "/" + fiveWeekdaysLater.getNumericMonth() + "/" + fiveWeekdaysLater.getYear() + " " + fiveWeekdaysLater.getHours() + ":" + fiveWeekdaysLater.getMinutes() + ":" + fiveWeekdaysLater.getSeconds()); } catch ( DtpDateException date_e ) { System.out.println(date_e.getMessage()); }
See also