【发布时间】:2011-10-05 07:14:07
【问题描述】:
我的问题是:我有很多数据包含日期时间(在自己的本地时间),我需要将其转换为 UTC。看起来是这样的:
class Data
{
int id; //Some id for database
DateTime time; //Time in local time, i need to convert it to utc
}
//Converting:
1)Find this id in database and extract some info (which excatly?)
2)Convert time to UTC
我的问题是:我需要在数据库中保留哪种数据才能正确转换时间?
我的版本是:在本地时间和 utc 之间保持整数小时差,并通过将其添加到本地时间进行转换。但这是合适的解决方案吗?
【问题讨论】:
-
您的应用程序实际上会跨多个时区运行吗?