AdvancedHMI Software
General Category => Support Questions => Topic started by: MrPike on July 20, 2017, 11:55:04 PM
-
Hello Archie, I am trying to display a time that shows just the Minutes:Seconds:Milliseconds in a label. So far this code shows HH:mm:ss:ffff and I only want to remove the hours and only two places on the milliseconds. I am using two TimeStampLabel controls and taking the time span between the two as shown below. Just not sure how to trim off the excess and only show mm:ss:ff How can I do this? thank you.
Private Sub tslOnEmer_ValueChanged(sender As Object, e As EventArgs) Handles tslOnEmer.ValueChanged
Dim difference As TimeSpan = DateTime.Parse(tslOnEmer.Text) - DateTime.Parse(tslLossOfNorm.Text)
lblTimeDiff.Text = difference.ToString()
End Sub
-
I'm thinking it is something like this:
difference.ToString("mm\:ss\:ff")
-
Ah yes. I was close. I didn't have the backslashes which caused it to crash. Works great now, thanks!!