user93830
user93830

Reputation: 21

Coverting MySQl 'YYYY-MM-DD' to .Net DateTimePicker

How can I read Default Mysql Date 'YYYY-MM-DD' using Datareader and convert it into .Net c# DatetimePicker.

In Short I want to see my date entered into MySQL visually selected on Datetimepicker. ie Input from Mysql Default Date and Output on DateTimePicker on my Form.

Upvotes: 0

Views: 166

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500675

Don't read it as a string at all. Use the GetDateTime method on the reader to read it as a DateTime, and then you can specify that as the value of the DateTimePicker. It's worth avoiding string conversions wherever possible, in my opinion - they cause a lot of problems.

Upvotes: 1

Related Questions