iOS将时间戳转换成时间字符串类的方法代码

2015-01-20 0 505
iOS将时间戳转换成时间字符串类的方法代码
//将date时间戳转变成时间字符串
//@paaram   date            用于转换的时间
//@param    formatString    时间格式(yyyy-MM-dd HH:mm:ss)
//@return   NSString        返回字字符如(2012-8-8 11:11:11)
+ (NSString *)getDateStringWithDate:(NSDate *)date
                         DateFormat:(NSString *)formatString
{
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:formatString];
    NSString *dateString = [dateFormat stringFromDate:date];
    NSLog(@"date: %@", dateString);
    [dateFormat release];
    return dateString;
}

遇见资源网 objective-c iOS将时间戳转换成时间字符串类的方法代码 http://www.ox520.com/15966.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务