Re: Julian date
Re: Julian date
- Subject: Re: Julian date
- From: David Riggle <email@hidden>
- Date: Fri, 08 Jan 2010 07:46:00 -0800
These two methods work fine for my astronomical calculations. Maybe they'll be inaccurate after 2100. Beats me. The world's going to end in 2012 anyway. ;)
@implementation NSDate (JulianDates)
- (NSTimeInterval)julianDate
{
return ([self timeIntervalSince1970] / 86400.0) + 2440587.50000;
}
+ (NSDate *)dateFromJulianDate:(NSTimeInterval)julianDate
{
NSTimeInterval seconds = (julianDate - 2440587.50000) * 86400.0;
return [NSDate dateWithTimeIntervalSince1970:seconds];
}
@end
_______________________________________________
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:
This email sent to email@hidden