IOS 数字日期转化为字符串

View Code
+ (NSString *)dateIntToDateStr:(NSInteger)dateInt
{
    int year = dateInt / 10000;
    int month = dateInt % 10000 / 100;
    int day = dateInt % 100;
    NSString *date = [NSString stringWithFormat:@"%d-%d-%d", year, month, day];
    NSLog(@"date is %@",date);
    return date;
}

输入:20130129
输出:2013-1-29

 

posted @ 2013-01-30 20:01  菜鸟程序猿  阅读(367)  评论(0编辑  收藏  举报