Questions tagged [nscalendar]

NSCalendar is an Apple MacOS and iOS class to deal with calendrical computation.

a “toll-free bridged” counterpart to CFCalendar, an Objective-C component that provides information about the calendar and support for computations such as determining the range of a given calendrical unit and adding units to a given absolute time.

Reference: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/Reference/NSCalendar.html

612 questions
-2
votes
2 answers

Create own NSDate

I would like to create an NSDate. It should be the year 1, the month 1, the day 1, the minute 0, the seccond 0 and the nanoseccond 0. I don not know how I can create this day myself. So do you guys know how to do this in Swift? Thanks a lot for your…
Vpor
  • 147
  • 1
  • 1
  • 7
-2
votes
1 answer

[__NSCFCalendar components:fromDate:toDate:options:]: fromDate cannot be nil

I am getting this error .How to solve it.Please suggest me. Crash Report [__NSCFCalendar components:fromDate:toDate:options:]: fromDate cannot be nil I mean really, what do you think that operation is supposed to mean with a nil fromDate? An…
Ravikumar
  • 85
  • 1
  • 16
-2
votes
1 answer

Issues with initWithFormat value from server

Please how do I make my initWithFormat to display in as 8:00am - 2:30pm? Help please!! I have already added "dd-MM-yyyy 'at' h:mm:ss a" //opening NSString *startDate= ((Timeslot *)[self.timeslots objectAtIndex:i]).startDateTime; NSArray…
senimii
  • 247
  • 2
  • 10
-2
votes
1 answer

How to get first date of MONTH, and first date of YEAR for a incoming date. in iPhone Objective c

Possible Duplicate: How to get all the days/dates in current week, this month, this year using the current date (today) in iPhone I need to get the first day of Month, first day of Year for a date (Most of times input date is current date…
user1811427
  • 359
  • 2
  • 6
  • 17
-2
votes
1 answer

How to implement cache manager in objective c?

I want to implement cache manager,for that I want to clear the cache after 15 days, how to implement this? How will I get to know 15 days completed or not, How I can achieve this any idea?
user196320
  • 97
  • 1
  • 3
  • 8
-3
votes
1 answer

Calendar.current.date(bySettingHour takes so long to compile

I have used Calendar.current.date(bySettingHour code for setting particular date. Problem is it takes so long to compile ~4 seconds print("Time seconds ",Date().timeIntervalSince1970) for i in 0..<9999 { let nowDate =…
Amit
  • 556
  • 1
  • 7
  • 24
-3
votes
1 answer

Group array of Swift dates by month

I have an array of Swift dates: [date1, date2, date3, ..., dateN] I want to group these dates by month: [ [date1, date2], [date3], ... [dateN], ] All days of a month should be inside the same month array. How can I group an array…
netshark1000
  • 7,245
  • 9
  • 59
  • 116
-3
votes
2 answers

How to get number of weeks by month in year?

I want a function that will return an array of week numbers for current month in current year. For example if the current month is August, 2015 it will return [32, 33, 34, 35, 36]. If month is February, 2015 it will return [6, 7, 8, 9]. Is there a…
mkz
  • 2,302
  • 2
  • 30
  • 43
-3
votes
1 answer

From date cannot be nil in Objective-c

I'm trying to get the seconds between two dates, for this I'm using the NSDateComponents: NSString *start = components2[0];// 2014-10-14 20:52:43 NSString *end = components[0];// 2014-10-14 20:54:40 NSLog(@"Start -> %@, End ->…
user3781174
  • 245
  • 5
  • 16
-3
votes
2 answers

Current day in year

Possible Duplicate: How do you calculate the day of the year for a specific date in Objective C I am looking for a way to find the day number which has past in current year. For example if today was 2013-03-22 , then the number should be 81,…
Lukas
  • 2,515
  • 4
  • 28
  • 37
-5
votes
1 answer

How can I get my current date ios Swift?

Specifically I would like to print my current date formatted like this - 2016-12-08 03:37:22 +0000. I've tried NSDateComponents. Swift 2.1 is telling me NSSecondCalendarUnit is deprecated and it doesn't recognize NSCalendarUnitSecond. What is…
Charles Jr
  • 8,333
  • 15
  • 53
  • 74
-7
votes
2 answers

Swift - Create an array of weekdays

Context I'm making an app where I have alarm and I need to show the time remaining to next alarm. Problem How do I get the array of selected Dates? Example User selected MO TU WE TH FR SA SU and time 07:30. Now I need to get Dates for those 7 days…
Marksss
  • 11
  • 3
1 2 3
40
41