iOS 8中的日期格式的NSDateFormatter问题 [英] NSDateFormatter issue with date format in iOS 8

查看:152
本文介绍了iOS 8中的日期格式的NSDateFormatter问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个NSDateFormatter,用于将NSDate格式化为字符串。以下格式不起作用:ddMMyyyy_hhmmss_SSS。当我尝试格式化NSDate时,我得到以下输出:18092014_08:49:03,638,它有一个冒号和一个我没有在格式中指定的逗号。请注意,在iOS 7中,我从未遇到过这种问题。
这是我正在使用的代码:

I have an NSDateFormatter which I use to format an NSDate into a string. The following format does not work: ddMMyyyy_hhmmss_SSS. When I try to format an NSDate I get the following output: 18092014_08:49:03,638, which has a colon and a comma I didn't specify in the format. Note that in iOS 7 I never had this kind of problem. This is the code I'm using:

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat: @"ddMMyyyy_hhmmss_SSS"];
NSString *dateString = [dateFormat stringFromDate:exportDate];


推荐答案

iOS8在时间格式imo方面存在严重问题。我刚刚解决了我的应用程序上的一个错误(我从来没有使用iOS7)去设置 - >一般 - >日期时间 - >时间格式,将它从24切换到12然后再切换到24并且所有工作都开始工作再次。

iOS8 have serious problem with time format imo. I've just resolved a bug on my application (that i've never had with iOS7) going to settings -> general -> date time -> time format, switching it from 24 to 12 and then back to 24 and all started working again.

尝试做同样的程序,也许它也适合你!

Try to make my same procedure, maybe it work also for you!

这篇关于iOS 8中的日期格式的NSDateFormatter问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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