1. 时区
1.1 北京时间
Windows:TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");
Linux:TimeZoneInfo tzBeijing = TimeZoneInfo.FindSystemTimeZoneById("Asia/Shanghai");
1.2 美东时间
Window: TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); //美国东部时区
Linux:TimeZoneInfo.FindSystemTimeZoneById("America/New_York");
在Windows下执行获取的代码,迁移到Linux后报:
System.TimeZoneNotFoundException: The time zone ID 'China Standard Time' was not found on the local computer. ---> System.IO.FileNotFoundException: Could not find file '/usr/share/zoneinfo/China Standard Time'.