Combine date and time when date is a DateTime and time is a string

前端 未结 5 823
终归单人心
终归单人心 2021-02-03 18:12

I am working with an old mysql database in which a date is stored (without a time) as a datetime and a time is stored as a string (without a date).

In C# I then have a D

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-03 18:47

    var dt = new DateTime(2010, 06, 26); // time is zero by default
    var tm = TimeSpan.Parse("01:16:50");
    var fullDt = dt + tm; // 2010-06-26 01:16:50
    

提交回复
热议问题