Adding a Time to a DateTime in C#

后端 未结 6 1844
执笔经年
执笔经年 2020-12-05 06:32

I have a calendar and a textbox that contains a time of day. I want to create a datetime that is the combination of the two. I know I can do it by looking at the hours and m

6条回答
  •  我在风中等你
    2020-12-05 06:44

    Using https://github.com/FluentDateTime/FluentDateTime

    DateTime dateTime = DateTime.Now;
    DateTime combined = dateTime + 36.Hours();
    Console.WriteLine(combined);
    

提交回复
热议问题