IOS method code for converting timestamp to time string class

From , 5 Years ago, written in Objective-C, viewed 223 times.
URL https://pastebin.vip/view/c20bb2d9
  1. //将date时间戳转变成时间字符串
  2. //@paaram   date            用于转换的时间
  3. //@param    formatString    时间格式(yyyy-MM-dd HH:mm:ss)
  4. //@return   NSString        返回字字符如(2012-8-8 11:11:11)
  5. + (NSString *)getDateStringWithDate:(NSDate *)date
  6.                          DateFormat:(NSString *)formatString
  7. {
  8.     NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
  9.     [dateFormat setDateFormat:formatString];
  10.     NSString *dateString = [dateFormat stringFromDate:date];
  11.     NSLog(@"date: %@", dateString);
  12.     [dateFormat release];
  13.     return dateString;
  14. }
  15. //objectc/8374

Reply to "IOS method code for converting timestamp to time string class"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website