更新时间:2022-11-05 16:20:24
要添加到汉斯的评论:
这是都通过设计。时区的转换需要一个操作系统,保持在世界各地的时区的规则轨道的数据库。可在桌面级的机器,而不是像手机有限的设备可用。如果没有数据库,你只能知道一些有关UTC和器件配置该时区。您不能使用PCL,如果这是一个要求,使用商用的Web服务进行转换对你将是一个解决办法。
This is all entirely by design. Timezone conversions requires an operating system with a database that keeps track of the timezone rules across the world. Available on a desktop class machine, not available on limited devices like a phone. Without the database, you can only know something about UTC and the timezone for which the device was configured. You cannot use PCL if this is a requirement, using a commercial web service to make the conversion for you would be a workaround.
看一看野田佳彦时间。这是一个日期/时间库.NET有它自己的时区的数据,因此不必依赖操作系统。它还支持PCLS。
Have a look at Noda Time. This is a Date/Time library for .NET which has its own time zone data so it doesn't have to rely on the OS. It also supports PCLs.