Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date formatting in foxpro
Message
De
24/08/1998 06:43:13
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
24/08/1998 06:28:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00129236
Message ID:
00129247
Vues:
22
>if the date is of dd/mm/yy i 've to return dd/mm/yyyy
> (dd/mm/yy is only one format,and assuming i don't know the format )
>then how?
Rahd,
Foxpro (all versions including Foxbase) store date as YYYYMMDD in tables regardless of how you enter them. And as far as you work with date type then you need no conversion for date math.
* dd/mm/yy format used
? {01/01/98}+3 && {04/01/1998}
* dd/mm/yyyy format used
? {01/01/1998}+3 && {04/01/1998}
* mm/dd/yyyy format used
? {01/01/98}+3 && {01/04/1998}
* yyyy/mm/dd format used
? {1998/01/01}+3 && {1998/01/04}
The result is same Jan 4th, 1998. But anyway if you want to use conversion for some other reason :
lnOldFormat = set("date",1)
lcOldCentury = set("century")
set century on
set date to dmy
* Do your work
set century &lcOldCentury
do case
 case lnOldFormat = 0  && MDY
   set date to MDY
 case lnOldFormat = 1  && DMY
   set date to DMY
 case lnOldFormat = 2  && YMD
   set date to  YMD
endcase
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform