时区映射,从iPad的(目标C),以MVP的Web API(C#) [英] Time Zone Mapping from iPad (Objective C) to MVP Web API (C#)

查看:220
本文介绍了时区映射,从iPad的(目标C),以MVP的Web API(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web服务(MVC的Web API),我保存在UTC日期时间值。而iPad的API进行通信,将通过在报头中的时区设置。该API将UTC值转换为基于iPad的发送的时区当地时间

I have a web service (MVC Web API) where I store the date time values in UTC. The iPad communicates with the API and will pass the time zone setting in the header. The API will convert the UTC value to the correct local time based on the time zone sent by the iPad.

好像我需要Objective C的时区值到C#的列表之间的映射(净值)时区值。除了让iPad的隐蔽本地时间,这是最好的方法是什么?

It seems like I will need a mapping between the list of Objective C time zone values to the C#(.net) time zone values. Other than making the iPad covert to local time, is this the best way?

GMT时区转换目标C

http://msdn.microsoft。 COM / EN-US /库/ ms912391%28V = winembedded.11%29.aspx

推荐答案

如果用Objective C的时区值你的意思的 IANA 的时区,如美国/纽约,那么你应该使用野田佳彦时间在.NET code。

If by "Objective C time zone values" you mean IANA time zones, such as "America/New_York", then you should use Noda Time in your .NET code.

preferably,你应该只使用IANA时区,因为它们。野田佳彦时间完全支持IANA区。

Preferably, you should just use the IANA time zones as they are. Noda Time fully supports the IANA zones.

不过,如果你有code,你的必须的使用Windows时区标识符,那么野田佳彦一次可使用的做翻译。但要做到这一点的唯一原因是,如果您有现有的使用.NET code的TimeZoneInfo 类。

However, if you have code where you must use the Windows time zone identifiers, then Noda Time can be used to do the translation. The only reason to do this though, is if you have existing code that uses the .net TimeZoneInfo class.

补充阅读:

  • Wikipedia article on the tz database
  • The timezone tag wiki here on StackOverflow

这篇关于时区映射,从iPad的(目标C),以MVP的Web API(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆