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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date issue 4

Status
Not open for further replies.

maggielady

Technical User
Jan 3, 2003
60
0
0
US
I have a table that has a date field in this format: 08032005. I need to get that field in this format: yyyymmdd. Can someone help please? Thanks in advance.
 
maggielady;

Assuming that OldDate = "08032005" and is MMDDYYYY

Code:
NewDate = RIGHT(OldDate,4) + LEFT(OldDate,2) + SUBSTR(OldDate,3,2)


Ed

Please let me know if the suggestion(s) I provide are helpful to you.
Sometimes you're the windshield... Sometimes you're the bug.
smallbug.gif
 
Maggie if you permenantly want all date fields to appear yyyymmdd then you can change the regional settings in control panel If however you only want this view or field in yr development you need to specify this in VFP's tools/options regional settings. If you want this to appear in this format in a field on a form then at class or object level you need to alter the property dateformat.

Bob Palmer
The most common solution is H2O!
 
For a date field in a table just use DTOS(datefield).

Regards,

Mike
 
Just to clarify what the others have said, if the field is actually defined as a Date field, then internally, it is stored as YYYYMMDD. In that case, the issue is how you display it, which you can control globally or locally.

If you have a character field that holds a date, Eguy's answer is the way to go.

Tamar
 
Thanks to everyone and your answers, I got it and it works great! Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top