-
May 4th, 2011, 02:00 PM
#1
Milliseconds always 000.
I've googled and searched this forum.
The answers don't seem to give the results I want.
I want to display the current time with a valid millisecond value...
I'm attempting:
Code:
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") // more code elided
At getting timestamps like:
5/04/2011 14:53:09.000
As you can see, 000 always trails. Is there a way to get valid milliseconds?
-
May 4th, 2011, 02:46 PM
#2
Re: Milliseconds always 000.
Not sure what the issue is, but I get ms back just fine using your code. Are you sure the issue isn't somewhere else? The resolution of DateTime is something like 15ms (which mimics the Windows timer resolution, but not the HighPerformanceTimer function(s) resolution). You can actually get better resolution, but it's not guaranteed, and you can get much worse if your CPU is bogged down.
-
May 7th, 2011, 04:52 PM
#3
Re: Milliseconds always 000.
I see you are not getting anything like what you coded: vis yyyy-MM-dd and you get 05/04/2011. Check your regional settings for date and time thru to milliseconds. I had this happen once before. If not, well, hey it was a bad guess. Have fun. Google this. I think I got the answer online.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|