Example
The following example shows how RWDateTime performs date calculations. This code prints out the date January 6, 1990, then calculates and prints the date of the previous Sunday, using the global locale:
 
#include <rw/db/db.h>
#include <rw/rstream.h>
 
int
main() {
RWDateTime dd(1990U, 1, 6);
 
cout << dd.asString() << ", a " << dd.weekDayName() << endl;
 
RWDateTime prev = dd.previous("Sunday");
 
cout << "The previous Sunday is: " << prev.asString() << endl;
return 0;
}
Program output:
01/06/90 00:00:00.000, a Saturday
The previous Sunday is: 12/31/89 00:00:00.000