Skip to content

Instantly share code, notes, and snippets.

@Kursulla
Created May 27, 2013 10:51
Show Gist options
  • Save Kursulla/5656460 to your computer and use it in GitHub Desktop.
Save Kursulla/5656460 to your computer and use it in GitHub Desktop.
Break NSDate into components (dat, month, hour,....) [Objective-C,ios,xcode,NSDate, NSDateComponents]
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:[NSDate date]];
long showMonth=(long)[components month];
long showDay=(long)[components day];
long showYear=(long)[components year];
long showHours=[[partsOfTime objectAtIndex:0] longLongValue];
long showMinutes=[[partsOfTime objectAtIndex:1] longLongValue];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment