.net - DateTime.Now vs. DateTime.UtcNow -


i've been wondering principles of how 2 properties work. know second 1 universal , doesn't deal time zones, can explain in detail how work , 1 should used in scenario?

datetime.utcnow tells date , time in coordinated universal time, called greenwich mean time time zone - if in london england, not during summer. datetime.now gives date , time appear in current locale.

i'd recommend using datetime.now whenever you're displaying date human being - way they're comfortable value see - it's can compare see on watch or clock. use datetime.utcnow when want store dates or use them later calculations way (in client-server model) calculations don't become confused clients in different time zones server or each other.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -