来自NSDate间隔的漂亮NSString?

时间:2015-03-29 21:47:33

标签: objective-c nsstring nsdate

有没有人知道从日期间隔获得一个短的漂亮字符串的好或最简单的方法?我想输入两个日期并获得尽可能简单的字符串,即

[2015-01-03 .. 2015-01-05] would output "Jan 3-5, 2015"
[2015-01-03 .. 2015-02-01] would output "Jan 3 - Feb 1, 2015"
[2015-01-03 .. 2016-02-01] would output "Jan 3, 2015 - Feb 1, 2016"

我甚至可以想象在上面添加小时,分钟和秒钟

[2015-01-03 08:00:00 .. 2015-01-03 10:00:00] would output "8-10 am, Jan 3, 2015"

然后是本地化的问题,所以在瑞典语第一个例子是:

[2015-01-03 .. 2015-01-05] would output "3-5 jan, 2015"

0 个答案:

没有答案