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

Convert MMDDYYYY to YYYYMMDD 1

Status
Not open for further replies.

MzKitty

Programmer
Oct 28, 2003
254
US
I am working on converting a file from a payroll package to a Gl package and I need to convert the date from a MMDDYYYY format to YYYYMMDD. I know it's something simple, but I don't do alot in VBA. Thanks for any help.

Cathy
 
If the field is a true DateTime field then nothing to do.
Otherwise you may try something like this:
newField = Right(oldField, 4) & Mid(oldField, 3, 2) & Left(oldField, 2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi Cathy!

Or you could use:

Format(CDate(YourTextField), "YYYYMMDD")

Assuming you are looking at a text field and not a date field. If it is a date field then apply the appropriate formatting at the table/query/form/report level.

hth


Jeff Bridgham
bridgham@purdue.edu
 
Thanks PHV - you saved me a lot of grief.

Cathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top