I'm trying to convert time in millisecunds (as double) to time in minutes and seconds. Does anyone have an easy way of doing this?
Printable View
I'm trying to convert time in millisecunds (as double) to time in minutes and seconds. Does anyone have an easy way of doing this?
Create a TimeSpan using the FromMilliseconds method, then use the TotalMinutes and Seconds properties.VB Code:
Dim milliseconds As Integer 'Store number of milliseconds here. Dim time As TimeSpan = TimeSpan.FromMilliseconds(milliseconds) Dim timeString As String = String.Format("{0:00}:{1:00}", Convert.ToInt32(Math.Floor(time.TotalMinutes)), time.Seconds) MessageBox.Show(timeString)
thanks, that was exactly what I where after.