Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date Format Conversion
Message
De
13/06/2003 10:36:14
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
13/06/2003 10:26:15
Jeffrey Havelock
Skipton Information Group
Leeds, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00799768
Message ID:
00799778
Vues:
23
>I have a character field containing dates in format "DD-MON-YY", i.e. "12-Jan-03".
>
>Has anyone got an easy answer to indexing this field in date order of year-month-day. Is there a function to convert i.e "Jan" to "01", "Feb" to "02" etc.?
>
>Regards
>
>Jeff

I don't think VFP has such a function built-in, but it is fairly easy to create a UDF, for instance:
function DateNameToNumber(tcMonth)
tcMonth = upper(tcMonth)
do case
case tcMonth = "JAN"
  return "01"
case tcMonth = "FEB"
  return "02"
...
case tcMonth = "DEC"
  return "12"
otherwise
  return "00"
endcase
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform