Convert Difference between 2 times into Milliseconds?

后端 未结 11 2183
梦毁少年i
梦毁少年i 2020-12-06 09:11

I have two masked TextBox controls and was wondering how I\'d go about getting the time in each one and then converting the difference into milliseconds. Like, say in tb1 I

11条回答
  •  清歌不尽
    2020-12-06 09:32

    DateTime dt1 = DateTime.Parse(maskedTextBox1.Text);
    DateTime dt2 = DateTime.Parse(maskedTextBox2.Text);
    TimeSpan span = dt2 - dt1;
    int ms = (int)span.TotalMilliseconds;
    

提交回复
热议问题