Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dates
Message
De
06/03/2003 07:52:24
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
05/03/2003 22:54:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Dates
Divers
Thread ID:
00761251
Message ID:
00762072
Vues:
22
Hi Carole

Problem is, I don't know the pattern in advance.

>I would start by creating a function like this:
>
>function getDate (tcPattern as character, tcDate as character) as date
>
>  * do some parameter error checking ...
>
>  lnday   = at(tcpattern,[dd])  && position of day in pattern
>  lnmonth = at(tcpattern,[mm])  && position of month in pattern
>  lnyear  = at(tcpattern,[yy])  && position of year in pattern
>  lnyearlen = iif([yyyy] $ tcpattern,4,2) && length of year in pattern
>
>  return (ctod(substr(tcdate,lnmonth,2)+;
>        "/"+substr(tcdate,lnday,2)+;
>        "/"+substr(tcdate,lnyear,lnyearlen))
>
>endfunc
>
>
>This of course will only work if you know the pattern that is being applied. Now that we have entered a new century it is harder to determine year than it used to be cause what is: "01/02/03" ?
>
>Have fun!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform