san*_*nta 0 calendar objective-c date-format ios tapku
在API中,所选日期格式如下 2013-11-01T23:00:00%2B0000
但我的日期格式是这样的: 2013-11-01T23:00:00+0000
要转换,我使用下面的代码:
NSString *plus = [NSString stringWithFormat:@"%@%@", [timeStamp substringToIndex:[timeStamp length]-5], @"%2B0000"];
Run Code Online (Sandbox Code Playgroud)
而不是(+)加号的unicode,即(%2B).
但是当我从Tapku日历中选择日期时,我收到错误,其中说日期格式错误.我该如何解决这个问题?
NSDate *tempDate=toDate;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss zzzz"];
[periodOfInspectionToTextField setText:[NSString stringWithFormat:@"%@",[df stringFromDate:d]]];
toDate=[df dateFromString:periodOfInspectionToTextField.text];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
236 次 |
| 最近记录: |