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.

NSDateComponents components:fromDate and Time Zones

I have a method which extracts the hour and second components form a NSDate by breaking it down into its …

iphone objective-c nsdatecomponents
Compare two NSDates for same date/time

Is date1 == date2 not a valid way to compare? If not, what is the correct alternative? Here's my code: - (…

iphone objective-c nsdate nscalendar nsdatecomponents
Working with NSDate components in Swift

I have a date that I need to split in some components. for example let components = NSCalendarUnit.CalendarUnitDay | NSCalendarUnit.CalendarUnitHour …

ios macos swift nsdate nsdatecomponents
Making Date With Given Numbers

I have the following Swift (Swift 3) function to make a date (Date) with date components (DateComponents). func makeDate(year: Int, …

swift3 nsdate nscalendar nsdatecomponents
NSDateComponents to NSDate - Swift

I have this function : private func getCurrentDateComponent() -> NSDateComponents { let date = NSDate() let calendar = NSCalendar.currentCalendar() let components = calendar.…

ios swift nsdate nsdatecomponents
Getting first day of a week with NSDateComponents : changing year

Hello I have a problem with setting a firstWeekDay, here is what I do: NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; …

objective-c cocoa nsdatecomponents
How to get dates of current month in Objective c?

I am developing a app which uses the date, month, year. I want the current month dates,because current month …

ios objective-c nsdate nsdatecomponents
NSDate, NSCalendar and NSDateComponents timing

NSDate *today = [NSDate date]; NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; [calendar setTimeZone:[NSTimeZone timeZoneWithName:@"GMT+2"]]; NSDateComponents *dateComponents = [calendar components:(NSDayCalendarUnit | …

iphone cocoa nsdate nscalendar nsdatecomponents
Trying to use NSDate for time only

I'm struggling to find a way to use NSDate for time only purposes. I was trying to do the following …

ios objective-c xcode nsdate nsdatecomponents