C# Datetime時間指定時區


string start_time_str = "2018-03-21 06:00:00";

DateTime.Parse(start_time_str)
2018/3/21 06:00:00 1521612000 格林威治時間UTC

DateTime.Parse(start_time_str).ToLocalTime()
2018/3/21 14:00:00 1521612000  東八區時間EST


DateTime.SpecifyKind(DateTime.Parse(start_time_str), DateTimeKind.Local)
2018/3/21 06:00:00 1521583200  東八區時間EST

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM