开发者

Calculating relative time offset

I was reading this article about relative time calculation

The problem is that the results are wrong due to the time offset. My webpage is Greek. So how should i modify that function to work correctly, including the GMT+2 or GMT+3 hours开发者_JS百科 offset?


I am Greek too, you only need to use the DateTime.Now, and not the DateTime.UtcNow

And by the way Greek is +2h


You shouldn't have a problem if you treat everything as UTC time. For example, instead of using DateTime.Now, use DateTime.UtcNow. Given that you are dealing with relative time, as long as everything is compared against the same base, you should be fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜