Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Damn Converting Dates
Message
From
03/10/2008 15:07:51
 
 
To
03/10/2008 14:59:53
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:
01352665
Views:
21
>No. The formats could be different. That's what the FormatFieldValue is for.
So the initial value of the FieldValue is a string with some format, isn't it?
Then why not just parse it?
FieldValue = '20080101'
? DATE(VAL(LEFT(FieldValue,4)), VAL(SUBSTR(FieldValue,5,2)), VAL(RIGHT(FieldValue,2)))


FieldValue = '01012008'
? DATE(VAL(RIGHT(FieldValue,4)), VAL(SUBSTR(FieldValue,4,2)), VAL(LEFT(FieldValue,2)))
>
>>And why you want from date to get date?
>>Isn't just:
>>
>>NewFieldValue = FieldValue 
>>
>>enough?
>>
>>
>>>No, that was intentional. I was just hoping someone would give me a clue in one of them how to handle the different formats. They all are basically the OTHERWISE condition right now.
>>>
>>>>Jay,
>>>>
>>>>Copy/paste code error? all of the expressions are identical... I'd hope they all give the same result *g*
>>>>
>>>>>I'm having trouble getting the NewFieldValue to evaluate to the correct character value. Can someone give me an example of what I need to do in one of the CASE conditions?
>>>>>
>>>>>
>>>>>FieldValue = {^2008/01/01}
>>>>>
>>>>>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
Next
Reply
Map
View

Click here to load this message in the networking platform