Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying current time using NSCalenderDAte




Am 31.05.2008 um 13:22 Uhr schrieb haresh vavdiya:

                NSCalendarDate *currentTime = [[NSCalendarDate alloc]
initWithTimeIntervalSinceReferenceDate:000000];

Since you specified a time interval of zero (one '0' is enough; it's just an integer), this will give you 1 January 2001, as stated by the documentation for -initWithTimeIntervalSinceReferenceDate:.


To get the current date you use

NSCalendarDate *currentDate = [NSCalendarDate calendarDate];

int minuteInc = (minute>=0 ? minute-[currentTime
minuteOfHour] : 0);
int hourInc = (hour>=0 ? hour-[currentTime hourOfDay] :
0);
[self incrementHour: hourInc andMinute:minuteInc];
[self time];

I have no idea what you are trying to do here ...


Andreas _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Displaying current time using NSCalenderDAte (From: "haresh vavdiya" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.