I have a SQL query being sent by C# system.data.odbc OdbcCommand
object.
SELECT Calldate
FROM calls;
The Calldate
column is a datetime type.
I want the select statement to only return the date portion of the value. The DateValue function doesn't seem to do anything. I am hoping to achieve this within the SQL provided to the OdbcCommand object.
Edit 1: The resource being queried is an access mdb file.
Given you are using sql server, you can convert the datetime
select convert(datetime, CallDate, x) from calls
x can represent different notations/numeric values for different date formatting. See this link for all the different numeric values, and the examples of their output.
http://linesofcode.net/snippets/45
EDIT (based on the fact that OP is using access, not SQL server)
You can format any string using the MS format function:
SELECT Format(CallDate,'yyyy/mm/dd') FROM calls
more formatting options here: http://www.webcheatsheet.com/SQL/access_functions/format.php
How about -
select datevalue(Calldate) from calls;
Other functions listed here