I am logging user actions throughout my program using datetime in the format hh:mm:ss:ff. I would like to calculate the difference between two times. Here is what I'm using for code:
Dim Time As Date
Time = DateTime.Now
Dim TaskTime As TimeSpan = Time.Subtract(AddMainBTime)
LogWriter.WriteLine("*TaskTime " & (TaskTime.ToString))
This works great, but I cannot figure out how to format the TaskTime to hh:mm:ss:ff. Right now, it writes to the file as hh:mm:ss.fffffff. When I try the following, I get the following error: 'Public Overrides Overloads Function ToString() As String' has no parameters and its return type cannot be indexed.
LogWriter.WriteLine("*TaskTime " & (TaskTime.ToString("hh:mm:ss:ff")))
Any ideas on how I can format my TimeSpan value? Thanks.
Dim Time As Date
Time = DateTime.Now
Dim TaskTime As TimeSpan = Time.Subtract(AddMainBTime)
LogWriter.WriteLine("*TaskTime " & (TaskTime.ToString))
This works great, but I cannot figure out how to format the TaskTime to hh:mm:ss:ff. Right now, it writes to the file as hh:mm:ss.fffffff. When I try the following, I get the following error: 'Public Overrides Overloads Function ToString() As String' has no parameters and its return type cannot be indexed.
LogWriter.WriteLine("*TaskTime " & (TaskTime.ToString("hh:mm:ss:ff")))
Any ideas on how I can format my TimeSpan value? Thanks.