Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing a query statement for dates

Status
Not open for further replies.

shenlingstyle

Electrical
Oct 5, 2005
8
0
0
CA
Hi, I'm a beginner in writing SQL statements.

Well basically I have a database with a date field. The data shows up like "11/23/2003 1:11:00 AM". The field is called START_DATE.

How can I write a query statement to extract all records that refer to tomorrow, December 15th, 2005?

Thanks all any help,

Colin
 
Replies continue below

Recommended for you

It depends what features your SQL engine has. This is an example which works on Firebird SQL engine:

select START_DATE from <your table> where CAST(START_DATE as DATE)=CURRENT_DATE+1

Here CURRENT_DATE is a function which return the current date from computer.
 
Many SQL dialects have a Between operator which is useful foe handling Dates and DateTime values

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Status
Not open for further replies.
Back
Top