Go Back   iPhone Dev SDK Forum > Development Forums > iPhone SDK Development

Featured Member Applications

TanZen ($0.99)

Endless Walls ($0.99)

Air Hockey ($0.99)

SUPER STRIKE - Motion Bowl ($0.99)

BarSlot ($0.99)

MeterRead ($0.99)

Colorblind Helper ($4.99)

gContacts ($1.99)

ProgCalc ($1.99)

Forex On The Go Lite (FREE)

HUE knewit! ($0.99)

Want your application to be advertised here?

» Advertisements


Visit our friends over at The App Show! Steve and Dave produce a weekly show shining a light on the iPhone 2.0 software and the applications being developed by the amazing development community for the iPhone SDK!
» Stats
Members: 3,913
Threads: 5,612
Posts: 23,248
Top Poster: scottiphone (705)
Welcome to our newest member, dtochetto
Reply
 
LinkBack Thread Tools Display Modes
Old 10-06-2008, 06:32 PM   #1 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Sep 2008
Posts: 190
Default gregorian not supported

in the API it says that this would work, isn't gregorian just a standard by which days are organized?

NSDate *currentDate = [NSDate date];
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setDay:10];
NSDate *date = [gregorian dateByAddingComponents:comps toDate:currentDate options:0];
[comps release];

It says that gregorian is undeclared

Edit: This works, it was because the gregorian calendar was not define, I mistakingly thought that it was a built in method. This code works:

NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *weekdayComponents =
[gregorian componentsNSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:today];
NSInteger day = [weekdayComponents day];
NSInteger weekday = [weekdayComponents weekday];
noobAppDeveloper is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Powered by vBadvanced CMPS v3.0.1

All times are GMT -5. The time now is 03:39 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0