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!

How get just date part of datetime column in SQL

Status
Not open for further replies.

gazolba

Programmer
Dec 4, 2001
167
0
0
US
How get just date part of datetime column in SQL?
 
Several Ways

Format (DateField, "yyyy-mm-dd")

cDate ( Int ( DateField ) )

DateSerial ( Year(DateField), Month(DateField), Day(DateField) )
 
Are any standard SQL as opposed to Jet-specific ??
 
I don't think there is any generic sql method for this. In Access, I would use:
DateValue([DateTimeField])


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
the sql standard allows for three types of temporal data: DATE, TIME, and TIMESTAMP

they look and behave exactly like thier names indicate -- DATE stores dates (only), TIME stores times (only), and TIMESTAMP stores a datetime down to a nanosecond

to convert from one to the other, use the CAST function

not very useful when you're talking about Access, but hey, you did ask...

rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top