Top "Nsdatecomponents" questions

NSDateComponents is a class in Apple's Cocoa and CocoaTouch frameworks which represents either a date or a period of time as composed of several elements -- days, hours, and months, for example.

NSDate get year/month/day

How can I get the year/month/day of a NSDate object, given no other information? I realize that I …

objective-c nsdate nsdatecomponents nscalendar
Swift 3.0 : Convert server UTC time to local time and vice-versa

I want to convert server UTC time to local time and vice-versa. Here is my code.. var isTimeFromServer = true var …

swift nsdate nsdateformatter nsdatecomponents
NSDate beginning of day and end of day

-(NSDate *)beginningOfDay:(NSDate *)date { NSCalendar *cal = [NSCalendar currentCalendar]; NSDateComponents *components = [cal components:( NSMonthCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit ) fromDate:date]; […

ios nsdate nsdatecomponents
Calculate age from birth date using NSDateComponents in Swift

I am trying calculate the age from birthdayDate in Swift with this function: var calendar : NSCalendar = NSCalendar.currentCalendar() var dateComponentNow : …

swift nsdatecomponents
how do I set an existing NSDate's time?

how do I set an existing NSDate's time? That is I have a date (say current date/time), but then …

objective-c nsdate nscalendar nsdatecomponents
NSDate from NSDateComponents

I am trying to alter the hh, mm, ss component of an NSDate to that of another NSDate - but …

iphone objective-c nsdate nsdatecomponents
NSDateComponents of an NSDate

How do I get the NSDateComponents of a single NSDate? I don't want the components of the difference between 2 dates, …

objective-c cocoa nsdate nsdatecomponents
How to find what day of the week for any given date using Cocoa

I'm trying to figure out what day (i.e. Monday, Friday...) of any given date (i.e. Jun 27th, 2009) Thank …

objective-c cocoa nsdate nscalendar nsdatecomponents
All dates between two Date objects (Swift)

I’m creating a date using NSDateComponents(). let startDate = NSDateComponents() startDate.year = 2015 startDate.month = 9 startDate.day = 1 let calendar = NSCalendar.currentCalendar() …

swift nsdate nsdateformatter nscalendar nsdatecomponents
NSDate subtract one month

I want two NSInteger year, month to go one month back. e.g. now is 2011-01 how can I get 2010…

iphone objective-c nsdate nsdatecomponents