What's best practice to represent a Time object in C#?

后端 未结 7 746
情歌与酒
情歌与酒 2020-12-18 19:20

I have a Time column in a database table. The date is not important, we just want a time in the day. What type would be best to represent it in C#? I was going to use a Date

相关标签:
7条回答
  • 2020-12-18 20:00

    You could try something like this

    TimeSpan ts = DateTime.Now.TimeOfDay
    

    Where you are applying the time property of the DateTime object and just use that.

    0 讨论(0)
提交回复
热议问题