.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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -