I want to use dateTimerPicker Time format {mm:ss} and use it in timer.interval.
meaning converting the dateTimePicker value to double and开发者_StackOverflow社区 back again.
any thoughts ?
Use this:
timer.Interval = dateTimePicker.Value.TimeOfDay.TotalMilliseconds
timer.interval is in milliseconds. (mm * 60 + ss) * 1000 = time in milliseconds.
Or easier is DateTime.TimeOfDay.TotalMilliseconds.
Perhaps it is also beter to use the TimeSpan object instead of the DateTime. Because you are not using the Date part of it. (Maybe for other reasons which I don't know)
You then can use the TimeSpan.TotalMilliseconds property.
TimeSpan on MSDN
加载中,请稍侯......
精彩评论