Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kooky SET DATE
Message
De
17/09/1998 11:27:47
 
 
À
17/09/1998 09:19:53
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Titre:
Divers
Thread ID:
00137626
Message ID:
00137817
Vues:
33
>>>There is definitely something screwy going on. The following code...
>>>
>>>*part 1
>>>set date to dmy
>>>x={12/08/98}
>>>? x, day(x), month(x), year(x)
>>>*part 2
>>>set date to mdy
>>>x={12/08/98}
>>>? x, day(x), month(x), year(x)
>>>
>>>should return...
>>>
>>>12/08/98 12 8 1998
>>>12/08/98 8 12 1998
>>>
>>>but depending on which part I comment out and then re-run, I either get
>>>
>>>08/12/98 12 8 1998
>>>12/08/98 12 8 1998
>>>
>>>or
>>>
>>>08/12/98 8 12 1998
>>>12/08/98 8 12 1998
>>
>>Your date setting in effect at the time the .PRG is COMPILED controls which you see. For some reason, if you put some kind of wait state in between, (I used MessageBox), the date constants get re-evaluated to what your current setting in the .PRG is. I don't know why that is, but that sure is what is happening.
>>
>>IE:
>>At command window:
>>SET DATE TO MDY
>>COMPILE DateTest.PRG
>>DO DateTest
>>
>>This gives you the Month OK
>>
>>Now do:
>>SET DATE TO DMY
>>COMPILE DateTest.PRG
>>DO DateTest
>>
>>This gives you the different results.
>>
>>DateTest.PRG:
>>SET DATE TO MDY
>>dv = {12/08/98}
>>?MONTH(dv)
>>SET DATE TO DMY
>>dv = {12/08/98}
>>?MONTH(dv)
>>
>>
>>If you use the date constant format {^1998/12/08} it will always be the month.
>
>1) Where did you find the date constant format? I couldn't find it in the VFP
on-line help.

See Help: StrictDateEntry

>2) Can anyone tell me if this has been fixed in VFP6?

It still works the same way in VFP6.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform