 |
 |
NSCalendarDate problems using new beta Developer tools??
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Status:
Offline
|
|
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:@"EST"]]; </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
|
|
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
|
|
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
|
|
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
|
|
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:@"EST"]]; </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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|