NSDate 北京时间
来源:互联网 发布:python sha.new 编辑:程序博客网 时间:2024/06/04 23:19
NSString *currentDate = [selfcurrentDateWithTimeZone:@"BJ" date:[NSDate date]];
- (NSString *)currentDateWithTimeZone:(NSString *)zone date:(NSDate *)sourceDate {
NSTimeZone* sourceTimeZone = [NSTimeZonetimeZoneWithAbbreviation:zone];
NSTimeZone* destinationTimeZone = [NSTimeZonesystemTimeZone];
NSInteger sourceGMTOffset = [sourceTimeZonesecondsFromGMTForDate:sourceDate];
NSInteger destinationGMTOffset = [destinationTimeZonesecondsFromGMTForDate:sourceDate];
NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;
NSDate* destinationDate = [[[NSDatealloc] initWithTimeInterval:intervalsinceDate:sourceDate] autorelease];
NSString *dateStr = [NSStringstringWithFormat:@"%@", destinationDate];
NSString *currentStr = [dateStr substringToIndex:10]; 取前十位 xxxx-xx-xx
return currentStr;
}
- NSDate 北京时间
- 北京时间
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- NSDate
- Js中的window.parent ,window.top,window.self 详解
- 有关静态lib编译的注意点
- SMRAM
- java wsdl反向生成源码,并使用CXF实现客户端调用代码
- 整数移位
- NSDate 北京时间
- 算法时间复杂度分析
- CheckBox的OnCheckedChangeListener、OnClickListener、OnTouchListener
- log4j处理tomcat日志
- CentOS无线网络配置
- android 笨鸟到菜鸟学习进阶篇,不错学习一下
- VC得到选择的文件夹的路径
- 变长参数函数(转载)
- 菜鸟收藏:不为人知的Word段间距设置