We help IT Professionals succeed at work.
Get Started

how to filter data by date and time from datetime column

586 Views
Last Modified: 2012-06-21
Hi,
I`ve got table with DATE_START column ( datetime ).
I want to allow user to choose the period which he is interested in.
He can choose the date and time from datetimepicker component.

d1:= FormatDateTime('yyyy-MM-dd',DateTimePicker1.DateTime)+' '+FormatDateTime('HH:mm:ss',DateTimePicker3.Time);

  d2:= FormatDateTime('yyyy-MM-dd',DateTimePicker2.DateTime)+' '+FormatDateTime('HH:mm:ss',DateTimePicker4.Time);

here is my query - but it doesn`t work

SELECT * FROM TABLE  WHERE DATE_START BETWEEN :d1 AND :d2

Search.Params.ParamByName('d1').AsString := d1;
Search.Params.ParamByName('d2').AsString := d2;

plz show me a query
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2011
Commented:
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE