Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning the correct year (2000 instead of 1900) 1

Status
Not open for further replies.

KenCao

Programmer
Feb 23, 2000
1
US
How do you convert &quot; 000125&quot; (YYMMDD date format) to 01/25/2000 instead of 01/25/1900. I am currently using Visual FoxPro 5. <br>
<br>
Thanks,<br>
<br>
Ken<br>
<br>

 
There are several ways to do this, each giving you what you want. In the example below, I chose not to assume the current century, but rather take it from the current date:<br>
<br>
x = &quot;000125&quot;<br>
cAnswer = substr(x,3,2) + &quot;/&quot; + substr(x,5,2)+ &quot;/&quot; + left(dtos(date()),2) + left(x,2)<br>
<br>
or, to get a date type:<br>
<br>
dAnswer = ctod(substr(x,3,2) + &quot;/&quot; + substr(x,5,2)+ &quot;/&quot; + left(dtos(date()),2) + left(x,2))<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top