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

ACCESS Date Conversion 1

Status
Not open for further replies.

md092686

IS-IT--Management
Jul 20, 2007
18
0
0
US
I have a field column with dates in this format 20070506. I need to convert this date to: 5/6/2007 with slashes but have the date appear as mm/dd/yyyy. Is there a quick conversion function to do this?

Thanks


md092686
 


Hi,
Code:
Expr: DateSerial(mid([YourFld],1,4)
,mid([YourFld],5,2),mid([YourFld],7,2))
converts your STRING to a DATE (which is just a NUMBER).

FORMAT to suite, (like mm/dd/yy)


Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
The date is formatted as a Number in Access from the Mainframe. I have placed your Expression in the criteria part as: DateSerial(mid([ABCDate],1,4)
,mid([ABCDate],5,2),mid([ABCDate],7,2))
Yet, when this is run, i get no results. Don't you need the "/" between & somehow?
 




"I have placed your Expression in the criteria part as..."

This is NOT a criteria.

It is in the SELECT statement, in place of your field name.

Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 




also...

"The date is formatted as a Number in Access from the Mainframe"

It should not be a number. Will you ever do arithmetic with these values?

The answer is NO. It is a STRING of NUMERIC CHARACTERS.

Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
Skip,

I knew that I guess I am not thinking well this Monday afternoon. Yes, you can never do arithmetic with a string.
Anyhow, I got it to work.

Thanks

md092686

 




"The date is formatted as a Number in Access from the Mainframe"

THAT is what I was referring to that ought to be a string.

Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
Skip,

I appreciate you helping me. I got it to work fine!

Thanks

md092686
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top