这个日期字符串的格式是什么? [英] In what format is this date string?

查看:378
本文介绍了这个日期字符串的格式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一堆NSStrings转换为NSDate对象。以下是一个示例字符串:

Im trying to convert a bunch of NSStrings into NSDate objects. Here is an example string:

2013-04-25T15:51:30.427+1.00

但是我无法弄清楚它的格式是什么,到目前为止我有(问号是我难倒的位) :

But I can't figure out what format it is in, so far I have (The question marks are the bits I'm stumped with):

yyyy-MM-ddTHH:mm:ss????zzz

我遇到的主要问题是.427部分,但如果我在其他地方犯了错误,请告诉我:)

The main problem I'm having is with the '.427' part although if I'm making a mistake elsewhere, let me know :)

有没有人有任何想法?或者可以指出我所有可能的日期格式说明符的列表?我发现了这个: http://msdn.microsoft.com/en-us/library /8kb3ddd4.aspx 这是有用的,但它似乎没有任何'.427'部分的说明符,我坚持。

Does anyone have any ideas? Or could point me to a list of all the possible date format specifiers? I found this: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx which is useful but it doesn't appear to have any specifier for the '.427' part that I'm stuck on.

感谢任何帮助,谢谢。

推荐答案

正确的格式是 yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ

参见各种日期格式模式

此外, +00:00 时区格式的 ZZZZZ 格式已添加到iOS 6,在iOS 5或iOS 5下不受支持早些时候。

Also, the ZZZZZ format for the +00:00 timezone format was added to iOS 6 and is not supported under iOS 5 or earlier.

这篇关于这个日期字符串的格式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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