NSDateFormatter的格式字符串产生毫秒 [英] Format string for NSDateFormatter to produce milliseconds

查看:95
本文介绍了NSDateFormatter的格式字符串产生毫秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我的日期格式正确,现在剩下的工作就是打印毫秒。

Since my date is well formatted now all there is left for me to do is to print milliseconds too.

我已经尝试过 setDateFormat yyyy / mm / dd hh:mm:ss:ms

这不起作用。

推荐答案

尝试使用 SS说明符(S的数量等于您要获取的数字的数量- 3)),例如

Try to use 'SS' specifier (with number of S's equal to number of digits you want to get - 3 in your case), e.g.

[formatter setDateFormat:@"yyyy/MM/dd hh:mm:ss:SSS"];

这篇关于NSDateFormatter的格式字符串产生毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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