iOS-獲取的NSDate date時間與實際相差8個小時解決方案 – iPhone手機開發技術文章 iPhone軟體開發教學課程

NSDate *date = [NSDate date];
    NSTimeZone *zone = [NSTimeZone systemTimeZone];
    NSInteger interval = [zone secondsFromGMTForDate: date];
    NSDate *localeDate = [date  dateByAddingTimeInterval: interval];
    NSLog(@"enddate=%@",localeDate);

 

摘自 shijiucdy的專欄

You May Also Like