摘要:
View Code + (NSString *) secondSince1970ToStr:(long long int)seconds{ NSDate *date = [NSDate dateWithTimeIntervalSince1970:seconds]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSString *str = [formatter stringFromDate:da.. 阅读全文
摘要:
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输出:2 阅读全文
摘要:
View Code -(NSString *)getAstroWithMonth:(int)m day:(int)d{ NSString *astroString = @"魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯"; NSString *astroFormat = @"102123444543"; NSString *result; if (m<1||m>12||d<1||d>31){ return @"错误日期格式!"; } if(m==2 && d>29) 阅读全文
摘要:
View Code - (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSString *dataStr = @"测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--测试自动换行--... 阅读全文