Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fox Pro 2.6 for DOS
Message
De
07/06/1998 10:13:51
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00101355
Message ID:
00105615
Vues:
28
> SET CENTURY ON
> REPLACE Date1 WITH CTOD('01/01/99') && Or use DATE() if you wish.
> REPLACE Date2 WITN CTOD('01/01/00') && Hoping for 2000???

Setting century on won't invent missing century digits - if you omit them, the default still remains welded to XX century.

>3. Now enter a date with a 4-digit year like this:
>
> REPLACE Date2 WITH CTOD('01/01/2000')

This is the way to go.

>This illustrates the fact that SET CENTURY ON does not completely solve the Y2K issue in FoxPro 2.6.

Did anyone expect this at all? Set Cent On just forces the user to enter all the four digits, and it surely won't scan your code looking for two-digit-year date constants.

> Your alternatives are to a) force your users to enter a 4-digit year (as simulated in step 3 above); or b) create a piece of code (i.e. a VALID snippet) that forces in a century 19 or 20 as appropriate.

Depending on your needs, you may combine the two. I've started applying the first approach three years ago, for a pharmaceutical warehouse - some things had expiry date in the next century, so in this app all the dates had to be four digits. Never had a problem with that.

>The nice thing about X-Base tables (All versions of Fox, dBASE, Clipper, etc.) and the newer RDBMS's (SQL Server, Oracle, etc.) is that all date fields ars stored with a 4-digit year. That leaves the interface for us to deal with. but even so, we are way ahead of those poor COBOL guys out there who have to fix all of the pre-Jurassic files that have 2-digit years in the date fields.

Eleven years ago I've been doing Cobol on a Vax; that winter we had some long weekend, and the machine was left without heating for several days. The end result was we've lost the battery clock, and had to type date&time every morning, with pretty strict syntax. Once, trying to concentrate on syntax (before the first coffee), I've got the syntax right, but the year I typed was 2987. Later, an operator noticed it, and came to alarm us; the boss panicked for an instant, but I calmed him immediately - our Cobol used 6 digit dates...

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform