How to get a date from MySql database to C# DateTime object?

前端 未结 3 1749
暗喜
暗喜 2021-01-23 01:20

I have a MySQL database with a certain field that contains a date.

How can I convert it to a C# DateTime object?

And how do I convert a C# Dat

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 01:58

    in database mysql yyyy-mm-dd

    so

    string date = DateTime.Now.ToString("yyyy-MM-dd");
    

提交回复
热议问题