将UNIX纪元转换为日期字符串

时间:2021-02-12 11:25:35

How do I convert from a unix epoch integer to date string?

如何将unix纪元整数转换为日期字符串?

1 个解决方案

#1


9  

Code:

代码:

NSUInteger *foo = 123456789;
NSString *bar = [[NSDate dateWithTimeIntervalSince1970:foo] description];

PLEASE PLEASE PLEASE PLEASE PLEASE be user-friendly and show the date according to the locale of the user: Cocoa - Localized string from NSDate, NSCalendarDate

请根据用户的语言环境显示日期:Cocoa -本地化字符串来自NSDate, NSCalendarDate

#1


9  

Code:

代码:

NSUInteger *foo = 123456789;
NSString *bar = [[NSDate dateWithTimeIntervalSince1970:foo] description];

PLEASE PLEASE PLEASE PLEASE PLEASE be user-friendly and show the date according to the locale of the user: Cocoa - Localized string from NSDate, NSCalendarDate

请根据用户的语言环境显示日期:Cocoa -本地化字符串来自NSDate, NSCalendarDate