Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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!!!
  • Administrators
Posted

http://ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemglobalizationdatetimeformatinfoclasstopic.htm

 

you could use a format of "HH:MM:SS:fffff" - vary the number of 'f's between 1 and 7 to get the fraction of a second a 1 to 7 digit precision.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • *Experts*
Posted

You can specify the format for a date object using its ToString method:

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...