tilde #3245(2007/10/04 08:33 GMT) [ Objective-C ] Rating0/0=0.00
OSXのCocoaとWindowsのGNUstepで動作確認しています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#import <Foundation/Foundation.h> void printWeekdays( unsigned year, unsigned month, unsigned day ) { NSCalendarDate* theDay = [NSCalendarDate dateWithYear:year month:month day:day hour:0 minute:0 second:0 timeZone:nil]; int offset = 1 - [theDay dayOfWeek]; for ( int i = 0; i < 5; i++ ) { NSCalendarDate* weekday = [theDay dateByAddingYears:0 months:0 days:offset + i hours:0 minutes:0 seconds:0]; NSLog( [weekday descriptionWithCalendarFormat:@"%Y/%m/%d %A"] ); } } int main( int argc, const char** argv ) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; printWeekdays( 2000, 1, 1 ); printWeekdays( 2008, 1, 1 ); [pool release]; return 0; }
Rating0/0=0.00-0+
[ reply ]
tilde #3245() [ Objective-C ] Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]