• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSCalendar: does the thing work at all? Or am I just blind?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSCalendar: does the thing work at all? Or am I just blind?


  • Subject: NSCalendar: does the thing work at all? Or am I just blind?
  • From: Ondra Cada <email@hidden>
  • Date: Wed, 25 May 2005 00:23:36 +0200

Hi all,

just have tried NSCalendar... perhaps I don't understand something in a very serious way, but WTH?!?

68 /tmp> <q.m
#import <Foundation/Foundation.h>
int main() {
[NSAutoreleasePool new];
NSCalendar *gc=[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
for (int today=1;today<5;today++) {
id comps=[[NSDateComponents alloc] init];
[comps setDay:today];
[comps setMonth:5];
[comps setYear:2005];
id date=[gc dateFromComponents:comps];
NSLog(@"Looks okay: %@",date);
comps=[gc components:NSYearCalendarUnit|NSMonthCalendarUnit| NSDayCalendarUnit fromDate:date];
NSLog(@"Looks bad: %d-%d-%d",[comps year],[comps month],[comps day]);
}
return 0;
}
69 /tmp> cc -Wall q.m -framework Foundation -std=gnu99 && ./a.out
2005-05-25 00:20:12.469 a.out[24838] Looks okay: 2005-05-01 00:00:00 +0200
2005-05-25 00:20:12.470 a.out[24838] Looks bad: -2021289069-1079642764--2688458
2005-05-25 00:20:12.472 a.out[24838] Looks okay: 2005-05-02 00:00:00 +0200
2005-05-25 00:20:12.473 a.out[24838] Looks bad: -2021289069-1079642764--2688458
2005-05-25 00:20:12.474 a.out[24838] Looks okay: 2005-05-03 00:00:00 +0200
2005-05-25 00:20:12.477 a.out[24838] Looks bad: -2021289069-1079642764--2688458
2005-05-25 00:20:12.478 a.out[24838] Looks okay: 2005-05-04 00:00:00 +0200
2005-05-25 00:20:12.479 a.out[24838] Looks bad: -2021289069-1079642764--2688458
70 /tmp>


---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSCalendar: does the thing work at all? Or am I just blind?
      • From: Chris Kane <email@hidden>
  • Prev by Date: Re: Grouping undo-able actions with CoreData
  • Next by Date: Re: FYI: User feedback for LSMinimumSystemVersion
  • Previous by thread: Re: Grouping undo-able actions with CoreData
  • Next by thread: Re: NSCalendar: does the thing work at all? Or am I just blind?
  • Index(es):
    • Date
    • Thread