Skip to content

Instantly share code, notes, and snippets.

@eienf
Created October 5, 2012 09:04
Show Gist options
  • Save eienf/3838844 to your computer and use it in GitHub Desktop.
Save eienf/3838844 to your computer and use it in GitHub Desktop.
Convert NSDate from NSCalendarDate
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSCalendarDate *cDate = [NSCalendarDate date];
NSLog(@"calendar date = %@",cDate);
NSDate *aDate = [NSDate date];
NSLog(@"calendar date = %@",aDate);
cDate = [NSCalendarDate dateWithTimeInterval:0 sinceDate:aDate];
NSLog(@"calendar date = %@",cDate);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment