¡@

Home 

c# Programming Glossary: datetime.utcnow

How do you mock out the file system in C# for unit testing?

http://stackoverflow.com/questions/1087351/how-do-you-mock-out-the-file-system-in-c-sharp-for-unit-testing

it online here . I've used this approach to mock out DateTime.UtcNow in an IClock interface really really useful for our testing..

Given a DateTime object, how do I get a ISO 8601 date in string format?

http://stackoverflow.com/questions/114983/given-a-datetime-object-how-do-i-get-a-iso-8601-date-in-string-format

how do I get a ISO 8601 date in string format Given DateTime.UtcNow How do I get a string which represents the same value in an.. datetime format iso8601 share improve this question DateTime.UtcNow.ToString yyyy MM ddTHH mm ss.fffffffzzz This gives you a date.. to 2008 09 22T13 57 31.2311892 04 00 Another way is DateTime.UtcNow.ToString o which gives you 2008 09 22T14 01 54.9571247Z To get..

How to get timestamp of tick precision in .NET / C#?

http://stackoverflow.com/questions/1416139/how-to-get-timestamp-of-tick-precision-in-net-c

When your application starts you would store the current DateTime.UtcNow value i.e. the crude resolution time when your application starts.. start a Stopwatch object like this DateTime _starttime DateTime.UtcNow Stopwatch _stopwatch Stopwatch.StartNew Then whenever you need.. UtcNow get if _stopWatch null _startTime.Add _maxIdle DateTime.UtcNow Reset return _startTime.AddTicks _stopWatch.Elapsed.Ticks..

C# DateTime.Now precision

http://stackoverflow.com/questions/2143140/c-sharp-datetime-now-precision

precision I just ran into some unexpected behavior with DateTime.UtcNow while doing some unit tests. It appears that when you call DateTime.Now..

Is DateTime.Now the best way to measure a function's performance?

http://stackoverflow.com/questions/28637/is-datetime-now-the-best-way-to-measure-a-functions-performance

that DateTime.Now often is quite a bit slower than DateTime.UtcNow due to the work that has to be done with timezones DST and such... the work that has to be done with timezones DST and such. DateTime.UtcNow typically has a resolution of 15 ms. See John Chapman's blog.. summary. Interesting trivia The stopwatch falls back on DateTime.UtcNow if your hardware doesn't support a high frequency counter. You..

How to use TimeZoneInfo to get local time during Daylight Savings Time?

http://stackoverflow.com/questions/2961848/how-to-use-timezoneinfo-to-get-local-time-during-daylight-savings-time

TimeZoneInfo to deal with daylight savings time. var dt DateTime.UtcNow Console.WriteLine dt.ToLocalTime var tz TimeZoneInfo.FindSystemTimeZoneById.. TimeZoneInfo then pass that to the ToOffset method var dt DateTime.UtcNow Console.WriteLine dt.ToLocalTime var tz TimeZoneInfo.FindSystemTimeZoneById..

How frequent is DateTime.Now updated ? or is there a more precise API to get the current time?

http://stackoverflow.com/questions/307582/how-frequent-is-datetime-now-updated-or-is-there-a-more-precise-api-to-get-the

code prints the number of ms between consecutive calls to DateTime.UtcNow in a loop Each row contains 100 characters and thus represents.. the next thing to see is the actual resolution of DateTime.UtcNow on my machine. Here's a run with no sleeping at all a . is printed.. but I assume it's related to overall CPU load. Conclusions DateTime.UtcNow can have a much higher resolution than 15ms Thread.Sleep 1 can..

DateTime vs DateTimeOffset

http://stackoverflow.com/questions/4331189/datetime-vs-datetimeoffset

Whenever we produce a DateTime we do it in UTC e.g. using DateTime.UtcNow and whenever we display one we convert back from UTC to the..

MemoryCache Strangeness

http://stackoverflow.com/questions/6895956/memorycache-strangeness

num this._idx ^ 1 this._cacheSizeSampleTimes this._idx DateTime.UtcNow this._cacheSizeSamples this._idx ref2.ApproximateSize IMemoryCacheManager..

How to elegantly deal with timezones

http://stackoverflow.com/questions/7577389/how-to-elegantly-deal-with-timezones

Getting the current time in UTC solved easily with DateTime.UtcNow . Pulling date times from the database and displaying these.. on the server are UTC. That means using like you said DateTime.UtcNow . Try to not trust the client passing dates to the server as.. in your GET and pass it to the ViewModel or on POST do DateTime.UtcNow . So far pretty standard fare but this is where things get 'interesting'...