當前位置:編程學習大全網 - 電腦編程 - c#時區轉換

c#時區轉換

讀取數據庫時間後,根據用戶時區進行轉換

//本地時間

DateTime localTime = new DateTime(2011, 03, 10, 17, 32, 00);

//時區:美國

string easternZoneId = "Pacific Standard Time";

TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById(easternZoneId);

this.textBox1.Text = TimeZoneInfo.ConvertTimeToUtc(localTime, easternZone).ToString();

  • 上一篇:YL236編程可以斷電嗎?
  • 下一篇:請教下,易語言主要用來做什麽呀?
  • copyright 2024編程學習大全網