Adding fractional seconds to TimeofDay

ljs235

Newcomer
Joined
Aug 12, 2003
Messages
6
Is there a way to format the TimeofDay property to include fractional seconds? Currently, the format is HH:MM:SS, but I would like it to be HH:MM:SS:FF. If this is not possible, what is another way I can write the time (to the nearest 1/100th second) to an output file? Right now, I have it simply writing the time of day. Thannks!!!
 
You can specify the format for a date object using its ToString method:
Visual Basic:
MessageBox.Show(DateTime.Now.ToString("hh:mm:ss:fffffff"))
This example will show you the current time plus fraction of a second with seven digit precision.
Dont use the TimeOfDay property because its a leftover from VB6, and those shouldnt be used.
 
Back
Top