>>I am trying to get my hands on a replacement function for the foxpro2.6 CTOD function.The problem is that this function will default to century 19 regardless of the system century when a variable is initialised with CTOD(' / / '). I've been told that such a replacement was provided with the March edition of Foxpro Advisor. Apparently it can be implemented using #DEFINE. Any help will be very, very much appreciated.
>I'm not sure I understand you. With set century on there wouldn't be a problem. Can you elaborate it more ?
>Cetin
Dermot,
Cetin is correct, CTOD( ) works fine. But it is controlled by the SET CENTURY TO xx ROLLOVER yy, not by SET CENTURY ON | OFF. If your character date has a four digit year then that's what CTOD( ) uses. If your character date has a two-digit year, then CTOD( ) respects the setting of SET CENTURY TO xx ROLLOVER yy.
Try the following (in VFP 5.0a):
SET CENTURY ON
SET CENTURY TO 19 ROLLOVER 50
?{06/26/98} --> 06/26/1998
?{06/26/48} --> 06/26/2048
?CTOD('06/26/98') --> 06/26/1998
?CTOD('06/26/48') --> 06/26/2048
BTW, you can display the values of the century default and rollover. In the example above,
?SET('CENTURY', 1) --> 19
?SET('CENTURY', 2) --> 50
HTH,
Rick
Rick Borup, MCSD
recursion (rE-kur'-shun) n.
see recursion.