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!

Pulling the Date out of a Date Time field. 1

Status
Not open for further replies.

jalge2

Technical User
Feb 5, 2003
105
0
0
US
I have a table with one of the Fields containing the Date/Time. I'm running a query where I only need the Date pulled out. The way that it's been working has been with this string

ADDED_DATE: Min(DateValue(Mid$([caroship table]![added_date],1,10)))

I'm unsure why but I keep getting a Data Mismatch Error.

Is there a better way to pull the date out?

Thanks a lot.

Jason Alge
Jason.M.Alge@lowes.com

'There are three kinds of people: Those who can count and those who can't'
 
Mid operates on strings and [caroship table]![added_date] is a datetime ... type mismatch!

Try this

ADDED_DATE: Format(MIN([caroship table]![added_date]),"mm/dd/yyyy")
 
Code:
MyDtTm = #3/27/2004 3:16:21 PM#


? MyDtTm
3/27/2004 3:16:21 PM 

? CDate(Format(MyDtTm, "m/d/yyyy"))
3/27/2004

as an example



MichaelRed


 
Golom that worked great. Thanks for the help. Have a star.


Jason Alge
Jason.M.Alge@lowes.com

'There are three kinds of people: Those who can count and those who can't'
 
Just as an aside, most of you know that date/times are stored as double precision numbers so to pull the date out of a true Date/Time field, just use the Int() function
Int(#1/6/05 12:45:06 PM#)
returns
1/6/05


Paul

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top