Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 TimeValue & DateValue for SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-20 : 09:14:18
Brian writes "Hi,

I am doing some work on a program (In VC++) that supports Access and SQL Server databases. I am trying to enter a filter to get records within time frames (based on dates AND/OR times).
I.e. between 01/01/2000 and 12/31/2001
or between 00:00 and 14:00
or between 12:00 and 14:00 on dates between 01/01/2000 and 31/01/2000.

For Access I can simply use TimeValue and DateValue to extract the times or dates, but these functions are not available in SQL Server. Any idea where I might find an implementation of them?

Note: The way the program is implemented, my filters are implemented in a WHERE clause that is passed to a lower layer when getting info from the DB.

Rgds,
Brian"

r937
Posting Yak Master

112 Posts

Posted - 2002-08-20 : 09:50:23
actually, i believe TimeValue and DateValue are intended to convert strings into times and dates, not to pull times and dates out of a datetime datatype

in any case, in sql/server you might want to CONVERT your datetime values into the appropriate string formats, and work with those, assuming you use high-to-low ordering, i.e. yyyy-mm-dd and hh:mm:ss

alternatively, use one or more of the Date and Time Functions


rudy
http://rudy.ca/
Go to Top of Page
   

- Advertisement -