Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSCalendarDate problems using new beta Developer tools??

NSCalendarDate problems using new beta Developer tools??
Thread Tools
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jul 5, 2002, 10:29 PM
 
I'm writing an app that deals with dates a lot. NSCalendarDate can be a real pain, but I've figured it out well. However, I've recently implemented a new NSPanel in my app whose controller has this line of code:

</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> NSCalendarDate *date = [NSCalendarDate dateWithYear:[newDate yearOfCommonEra]
month:[newDate monthOfYear]
day:[newDate dayOfMonth]
hour:[newDate hourOfDay]
second:[newDate secondOfMinute]
timeZone:[NSTimeZone timeZoneWithAbbreviation:@&quot;EST&quot;]]; </pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">newDate of course is another NSCalendarDate. The compiler is telling me that NSCalendarDate doesn't take this selector, which i know can't be because I've checked the dev docs. It seems to be a problem with the timeZone: part. I'm thinking that maybe it's a bug or something in the new dev tools... but that's unlikely...

Any help would be appreciated.

<small>[ 07-05-2002, 11:30 PM: Message edited by: itistoday ]</small>
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Jul 6, 2002, 02:15 AM
 
please ignore

<small>[ 07-06-2002, 03:17 AM: Message edited by: seb2 ]</small>
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 6, 2002, 03:55 AM
 
It looks like you forgot minute:.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jul 6, 2002, 10:09 AM
 
Can't you just do
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">NSCalendarDate *date = [newDate copy];</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">
     
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jul 6, 2002, 11:40 AM
 
Thanks guys. Chuck, thanks for seeing that detail, it fixed the problem of course (maybe i need glasses...). Angus_D, yeah, i could use that and it would be much easier, but it turned out that for my purposes, the following is better:

</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> NSCalendarDate *date = [NSCalendarDate dateWithYear:[newDate yearOfCommonEra]
month[newDate monthOfYear] == 1) ? (12) : ([newDate monthOfYear] - 1)
day:[newDate dayOfMonth]
hour:[newDate hourOfDay]
minute:[newDate minuteOfHour]
second:[newDate secondOfMinute]
timeZone:[NSTimeZone timeZoneWithAbbreviation:@&quot;EST&quot;]]; </pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">I think i'm done with my "MorgageApp". I made it for my mom actually, but it's a nice little tool, I think i'll post it on versiontracker.com. Thanks again.
     
   
Thread Tools
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -5. The time now is 09:59 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2