Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alpha date converted to numeral date
Message
De
18/03/2001 02:59:10
 
 
À
16/03/2001 12:43:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00485959
Message ID:
00486272
Vues:
13
John,

this runs in 1/3 the time:
function strtodate (cLongDate)
	return date( val(substr(cLongDate, at(",", cLongDate) + 1)), ;
 		(AT(UPPER(LEFT(ltrim(cLongDate), 3)), "   JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC") - 1) / 3, ;
 		VAL(SUBSTR(cLongDate, AT(" ", cLongDate) + 1, 2)))
endfunc
>Hey Jim,
>
>This'll do it.
>
>LPARAMETERS cLongDate
>nStrictdate=SET("STRICTDATE")
>cDate=RIGHT(cLongDate,4)
>cMonths="   JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
>cMonthNum=TRANSFORM((AT(UPPER(LEFT(cLongDate,3)),cMonths)-1)/3)
>cDayNum=TRANSFORM(VAL(SUBSTR(cLongDate,AT(" ",cLongDate)+1,2)))
>cDate=cMonthNum+"/"+cDayNum+"/"+cDate
>dDate=CTOD(cDate)
>SET STRICTDATE TO nStrictdate
>RETURN dDate
>
>Use as dMyDate=CVRTDATE("Sept 9,1999")
>
>>I once used a function or precedure I thought I downloaded from the knowledge base that I can't seem to find now. This code took a spelled out date like, Sept 3, 1999, and converted to a numeral date of 09/03/1999. Would someone know what that article number was on Knowledge base, or have the actual code that would convert the date type?
>>
>>TIA
>>
>>Jim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform