Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fox Pro 2.6 for DOS
Message
 
À
02/06/1998 14:47:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00101355
Message ID:
00104197
Vues:
24
>Thanks again for your help Bill. I would like to ask your help again on the same topic, however, I am going to restate the problem.
>
>Currently, the application has places within the prgs. in which a field in a database table is replaced with the date() function.
>
> e.g. Replace dDate With Date()
>
>The data type for the field in the table is Date. I forwarded my PC time to 01/01/2000 and tested the app.. Anytime time that the above situation occurred, the date in the table field was 01/01/1900. In addition, I have also placed Set Century On in the main.prg.
>
>Any ideas as to how to handle this?
>
Jason --

It seems that the SET CENTURY ON/OFF command just controls the manner in which a table's date fields are displayed -- it has no effect on data entry. For example, execute the following commands:

SELECT MyTable && Any table with date fields.
SET CENTURY OFF
BROWSE

Your date fields will be shown with 2-digit years, although the full 4-digit years are actually stored in the table. Now do this:

SET CENTURY ON
BROWSE

The full 4-digit years are now shown in the browse window.

As far as I know, the only way to handle the data entry problem you describe in FoxPro 2.6 is to force your users to enter the full 4-digit year when they enter a date. Of course, you could always write some code (probably in the VALID snippet for your date box) that would automagically plug in the century digits based on a cut-off year. For example, any keyed-in year in the range 00-70 would be changed to 2000-2070, while all other years would become 19xx.

The SET CENTURY command in VFP has a ROLLOVER clause that takes care of this problem...too bad that it does not work for FoxPro 2.6.

Again, I hope this helps you out, Jason. And by the way -- If any of you code warriors out there have a better solution for FoxPro 2.6, both Jason and I would like to learn about it from you!!!

Bill
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform