0

I have table that have column of datetime that have value like 2017-01-13 17:01:56. Such values will have more than hundreds in a day like ordering in a restaurant. Now I want to select the orders that applied only today or date from datepicker. I don't know how to write the WHERE condition. My database is MySql and I do on c# with WPF.

Thanks.

1
  • Date from date picker is like 13-Jan-17 12:00:00 AM
    – Meeraen
    Commented Jan 14, 2017 at 2:19

1 Answer 1

1

Date format is YYYY-MM-DD

SET @dt = '2017-01-03 00:00:00';
SELECT * FROM some_table
WHERE datefield >= @dt AND datefield < (@dt + INTERVAL 1 DAY);
1
  • Thanks. Now I like to pick date from datepicker of WPF with C# I'm stuck at this part
    – Meeraen
    Commented Jan 27, 2017 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.