I've published a web application to a server in the USA. The app is actually for swedes (people in Sweden) and I am lookin开发者_开发知识库g for the best way to hadle the time difference.
There's a +7 hour difference.
Should I store the DateTime.Now
in DB as it is, or should I use DateDiff to change the time before creating each record?
What's the best practice here? What to store in the database? Should the date only be differed when presenting it?
Best practices, please!
I usualy store the DateTime.UtcNow which is the utc time. So when it's 13.00 in UTC, it's 14.00 in Sweden and 7.00 in the USA, you store the UTC time (13.00) and you can always format the datetime with a New CultureInfo("sv-SE") to the local time in Sweden, the USA etc.
Michel
精彩评论