Last active
August 29, 2015 14:21
-
-
Save ZevEisenberg/d29476094201e4076c03 to your computer and use it in GitHub Desktop.
Localized Hours Range String
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDateComponents *comps = [[NSDateComponents alloc] init]; | |
comps.year = 2015; | |
comps.month = 5; | |
comps.day = 12; | |
comps.hour = 21; | |
NSDate *startDate = [[NSCalendar currentCalendar] dateFromComponents:comps]; | |
comps.day = 13; | |
comps.hour = 0; | |
NSDate *endDate = [[NSCalendar currentCalendar] dateFromComponents:comps]; | |
NSDateIntervalFormatter *formatter = [[NSDateIntervalFormatter alloc] init]; | |
formatter.timeZone = [NSTimeZone localTimeZone]; | |
formatter.dateStyle = NSDateFormatterNoStyle; | |
formatter.timeStyle = NSDateFormatterShortStyle; | |
NSString *string = [formatter stringFromDate:startDate toDate:endDate]; | |
NSLog(@"%@", string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment