Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
I need to capture the current time with 3 digits for seconds
Posted
Comments
Thanks7872 9-Oct-13 3:30am    
So whats the question?

1 solution

Use an appropriate overload of the ToString() method. What about
C#
string time = DateTime.Now.ToString("hh:mm:ss.fff");
 
Share this answer
 
Comments
Ron Beyer 10-Oct-13 0:39am    
+5'd, there is no such thing as 3 digit seconds...
Bernhard Hiller 10-Oct-13 3:02am    
Thanks. I guess he thought of three digits after the decimal separator, i.e. milliseconds.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900