>>I have a string that could contain one or more dates. The thing is that those date are of type character.
>>
>>How could I replace those dates in this string by their equivalent representation in date format
>>
>>Exemple:
>>
>>"AADSE 1999/11/28 ASDF 1999/10/29
>>
>>becomes
>>
>>"AADSE {^1999-11-28} ASDF {^1999-10-29}"
>>
>>
>>Is there a VFP function that would make it possible to do this?
>>If not what would be the easiest way?
>
>If the format is constant, the following might help
>*procedure DateStringConvert (sDS)
>parameter sDS
>* If the format always the same
>* 0 1 2 3
>* 12345678901234567890123456789012
>sDS=alltrim("AADSE 1999/11/28 ASDF 1999/10/29")
>* Needs to be
>* "AADSE {^1999-11-28} ASDF {^1999-10-29}"
>sCDS=[AADSE {^]+substr(sDS,7,10)+[}]+[ ASDF ]+[{^]+substr(sDS,23,10)+[}]
>do while at([/],sCDS)>0
>sCDS=stuff(sCDS,at([/],sCDS),1,[-])
>enddo
>? sCDS
>cancel
The format is not constant but thanks for your help. Maybe I will use part of that code.
Thanks Terry.
*******************************************************
Save a tree, eat a beaver.
Denis Chassé