How can I force RWDate to display a four digit year?

Article ID: 829
Last updated: 05 Feb, 2008
Article ID: 829
Last updated: 05 Feb, 2008
Revision: 1
Views: 4283
Posted: 26 Aug, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


Both RWDate or RWDBDateTime only display two digits for the year.


Cause


RWDate keeps track of days using Julian days. This system allows RWDate to store dates ranging from 1/1/100 until 6/5/2,939,805. Therefore internally RWDate does not ever run into year 2000 issues. However, RWDate by default displays its date with two digit years, and it can accept years as two digits in its constructors which could cause problems. You will get similar results with RWDBDateTime because it is based on RWDate.


Action


To force four digits to be displayed for the year, you need to define the pre-processor macro RW_CENTURY_REQD and then rebuild the Tools.h++ library.

For Unix versions of Tools.h++ v7.0.3 or earlier, add -DRW_CENTURY_REQD on the DTAG= line in the rogue/toolsrc/makefile file.

For PC versions of Tools.h++ v7.0.3 or earlier, consult the Tools.h++ documentation on building a library using a specific compiler and the CCOPTS= makefile option.

For version 7.0.6 of Tools.h++, using the Software Parts Manager and any compiler:

In the Build info window, double click on the Configurations folder. This will reveal build types such as SingleReleaseStatic - AIX4.2 - CSET3.1, etc. Use the mouse to select the build type you wish to modify and right-click it. This will bring up a pop-up menu; select copy. The build configuration dialog will appear. Name your custom cofiguration. In the Build Arguments field enter -DRW_CENTURY_REQD. Give a suffix for your library in Library Name Suffix field then click OK. Note that this will only create a modified version of the selected build type and none of the others.

With versions 7.0.7 and later of Tools.h++, in the custom configuration modification window, you need to add -DRW_CENTURY_REQD to both the pre-build arguments and the pre-link arguments.

As of version 7.1.0 of Tools.h++ and above versions, any regular build of Tools.h++ will give you the option to compile with RW_CENTURY_REQD defined during the build process.

The next step is to rebuild your libraries using your custom configuration.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 829
Last updated: 05 Feb, 2008
Revision: 1
Views: 4283
Posted: 26 Aug, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category