Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Damn Converting Dates
Message
 
To
03/10/2008 15:11:54
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01352632
Message ID:
01352671
Views:
33
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform