Now VS UtcNow


It's really quite simple, so I think it depends what your audience is and where they live.
If you don't use Utc, you must know the timezone of the person you're displaying dates and times to -- otherwise you will tell them something happened at 3 PM in system or server time, when it really happened at 5 PM where they happen to live.
We use DateTime.UtcNow because we have a global web audience, and because I'd prefer not to nag every user to fill out a form indicating what timezone they live in.
We also display relative times (2 hours ago, 1 day ago, etc) until the post ages enough that the time is "the same" no matter where on Earth you live.


credit: http://stackoverflow.com/questions/62151/datetime-now-vs-datetime-utcnow

ความคิดเห็น

บทความที่ได้รับความนิยม