文章标题
来源:互联网 发布:fifaonline3数据库更新 编辑:程序博客网 时间:2024/06/10 22:21
NSDate 对象转换为 NSString 对象:
NSDate *date = [NSDate date]; //创建表示当前时刻的 NSDate 对象
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @”yyyy-MM-dd HH:mm:ss”; //设置转换成字符串的格式
dateFormatter.timeZone = [NSTimeZone localTimeZone]; //设置时区为 iPhone 当前时区
NSString *dateString = [dateFormatter stringFromDate: date];
NSLog(@"date: %@", date);NSLog(@"dateString: %@", dateString);
NSString 对象转换为 NSDate 对象
NSString *dateString = @”2015-08-06 11:08:35”;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @”yyyy-MM-dd HH:mm:ss”;
dateFormatter.timeZone = [NSTimeZone localTimeZone];
NSDate *date = [dateFormatter dateFromString: dateString];
NSLog(@"dateString: %@", dateString);NSLog(@"date: %@", date);
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 如何为Apache JMeter开发插件(二)——第一个JMeter插件
- HTML5 标签audio添加网页背景音乐代码
- 高光谱了解
- comboBox设置当前实现数据
- HDU1024 Max Sum Plus Plus
- 文章标题
- Word Break II
- JSP中超链接跳转时的中文错误问题
- 火云开发课堂 - 《Shader从入门到精通》系列 第二节:在Shader中通过参数设置颜色
- oracle的导入导出imp/exp
- Python常用功能汇总
- 自定义UITableViewCell重用cell
- iOS开发-Xcode7模拟器会黑屏处理方法
- 关于myeclipse的破解run.bat一闪而过的问题