Formatting a DateTime object from .NET into a NSDate for objective-c

前端 未结 3 946
野性不改
野性不改 2021-01-05 03:11

I am working with an API that returns a .NET DateTime object into my iOS application. I\'m a little confused at what\'s going on, the DateTime looks fine when it leaves the

3条回答
  •  走了就别回头了
    2021-01-05 03:41

    Essentially what you're getting there is milliseconds from January 1st 1970 UTC, with the -0600 being the timezone offset. Take a look at this blog post http://weblogs.asp.net/bleroy/archive/2008/01/18/dates-and-json.aspx

    You would probably have to write a custom NSDateFormatter to handle a date in that format, or you could format it in .NET (easier), output a string in JSON, and then use a standard NSDateFormatter.

提交回复
热议问题