当前位置:编程学习 > wap >>

iphone NSString int date 等转换

//将int转换成NSString
NSString* s = [NSString stringWithFormat:@"%i", i];

//将NSString转换成int
[nsstring intValue];

//将NSDate转换成NSString

   NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
   [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString*strDate = [dateFormatterstringFromDate:_loginResult.dateLastLogin];
    _label.text= strDate;
   [dateFormatter release];


摘自 进阶码农的专栏
补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,