I have time of NSString type. I'm surprised that day comes, but I find some weird strange.
NSString * strTime = @ "2010-05-14 16:00:01"; NSDateFormatter * formatter = [[NSDateFormatter alloc] init]; [Format setDateFormat: @ "yyyy-MM-dd HH: mm: SS"]; NSDT * Old Data = [Formatter Debt Frostring: Stuttman]; Unsigned Indal Flag = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit; NSCalendar * Calendar = [NSCalendar Current Calendar]; NSDateComponents * Component = [Calendar Component: Date to Date: Old Date]; Int day = [day of components]; When NSString * strTime = @ "2010-05-14 16:00:01" day is 15, and when NSString * strTime = @ "2010-05-14 16:00: 00 "day is 14. I know why? itemprop = "text"> You are in California (probably) and the date object is GMT. Using NSCalendar means the date changes from your location to GMT. Will go.
Comments
Post a Comment