从iPhone应用程序,我必须发送日期作为参数到一个webservice方法,其中服务器解析逻辑用C#,.NET和JSON实现。从iphone应用程序发送日期时间到web服务
在我的iPhone应用程序,我格式化日期:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
[dateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"];
NSString *myDateString = [dateFormatter stringFromDate:SentOn];
我收到错误:
There was an error deserializing the object of type DashboardDataContract.Contracts.DashboardInputParams. DateTime content '2013-04-04T12:00:00Z' does not start with '/Date(' and end with ')/' as required for JSON.'.
我试图日期的不同格式。在这方面有人能帮助我吗?
非常好,简单的创建一个类的方法! – user2068793 2013-04-04 11:54:08
这是否可以在所有时区使用? – Anupdas 2013-04-04 12:03:52
如果您想添加时区,您需要格式为/ Date(xxxxxxxxxxxx + yyyy)/其中yyyy是时区,例如:/ Date(12345678954 + 0000)/ – 2013-04-04 12:06:35