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.

  • Date from date picker is like 13-Jan-17 12:00:00 AM – Meeraen Jan 14 '17 at 2:19
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);
| improve this answer | |
  • Thanks. Now I like to pick date from datepicker of WPF with C# I'm stuck at this part – Meeraen Jan 27 '17 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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