Convert DateTime to TimeSpan

前端 未结 5 1685
离开以前
离开以前 2020-12-03 12:56

I want to convert a DateTime instance into a TimeSpan instance, is it possible?

I\'ve looked around but I couldn\'t find what I want, I on

5条回答
  •  醉酒成梦
    2020-12-03 13:44

    Try the following code.

     TimeSpan CurrentTime = DateTime.Now.TimeOfDay;
    

    Get the time of the day and assign it to TimeSpan variable.

提交回复
热议问题