ljs235 Posted August 20, 2003 Posted August 20, 2003 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!!! Quote
Administrators PlausiblyDamp Posted August 21, 2003 Administrators Posted August 21, 2003 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ljs235 Posted August 21, 2003 Author Posted August 21, 2003 How do I declare this new format? Where does it go in my program? Quote
*Experts* mutant Posted August 21, 2003 *Experts* Posted August 21, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.