I have foxpro database that save date in string format<br>
example 20000201 . How can i print or display back in date<br>
format example 02/01/2000<br>
You didn't mention if your date format is mm/dd/yyyy or dd/mm/yyyy, but:<br>
<br>
Pretending that your field name is "MyDate", try this:<br>
<br>
CTOD(SUBSTR(MyDate, 5, 2) + "/" + ;<br>
SUBSTR(MyDate, 7, 2) + "/" + ;<br>
LEFT(MyDate, 4))<br>
<br>
If you are using VFP 6, then the preferable technique would be:<br>
<br>
CTOD('^' + LEFT(MyDate, 4) + "-" + ;<br>
SUBSTR(MyDate, 5, 2) + "-" + ;<br>
SUBSTR(MyDate, 7,2) )<br>
<br>
or the somewhat simpler:<br>
<br>
DATE(LEFT(MyDate, 4), ;<br>
SUBSTR(MyDate, 5, 2), ;<br>
SUBSTR(MyDate, 7, 2))<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.