我的問題是:我有很多數據包含日期時間(在本地時間),我需要將其轉換爲UTC。它看起來如此:我需要保存在數據庫中才能轉換爲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之間保持一個小時的整數差,並通過將它添加到本地時間進行轉換。但這是否合適?
將您的應用程序實際上是跨多個時區中運行時? – Pete