• 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
Re: Julian date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: iPhone: validate a NSString for US zipcode
  • Next by Date: Re: Optimizing View Drawing Code
  • Previous by thread: Re: Julian date
  • Next by thread: binding NSComboBox default selection
  • Index(es):
    • Date
    • Thread