Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Damn Converting Dates
Message
 
À
03/10/2008 15:11:54
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01352632
Message ID:
01352671
Vues:
32
>You are not looking at the values I think. FieldValue is a date() value. Look at the vars and the code in one of the CASE conditions.
OK, you want from date to get string:
*** 20081231 or CCYYMMDD
FieldValue = DATE(2008,12,31)
NewFieldValue = DTOS(FieldValue)

*** 12312008 or MMDDCCYY
FieldValue = DATE(2008,12,31)
NewFieldValue = SUBSTR(DTOS(FieldValue),5,2)+RIGHT(DTOS(FieldValue),2)+LEFT(DTOS(FieldValue),4)

*** 31122008 or DDMMCCYY
FieldValue = DATE(2008,12,31)
NewFieldValue = RIGHT(DTOS(FieldValue),2)+SUBSTR(DTOS(FieldValue),5,2)+LEFT(DTOS(FieldValue),4)
>>>>>>>DO CASE
>>>>>>> CASE FormatFieldValue = 'CCYYMMDD' && Should be "20080101"
>>>>>>> NewFieldValue = EVALUATE("ALLTRIM(TRANSFORM(DTOS(FieldValue), '@R " + REPLICATE('!',FieldLength) + "'))")
>>>>>>> CASE FormatFieldValue = 'MMDDCCYY' && Should be "01012008"
>>>>>>> NewFieldValue = EVALUATE("ALLTRIM(TRANSFORM(DTOS(FieldValue), '@R " + REPLICATE('!',FieldLength) + "'))")
>>>>>>> OTHERWISE && Leave it alone other than converting to text
>>>>>>> NewFieldValue = EVALUATE("ALLTRIM(TRANSFORM(DTOS(FieldValue), '@R " + REPLICATE('!',FieldLength) + "'))")
>>>>>>>ENDCASE
>>>>>>>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform