Re: Julian date
Re: Julian date
- Subject: Re: Julian date
- From: Fritz Anderson <email@hidden>
- Date: Thu, 7 Jan 2010 12:56:01 -0600
On 7 Jan 2010, at 12:22 PM, Kyle Sluder wrote:
> There is no standalone Julian calendar in Cocoa. The only way to
> interpret dates relative to a Julian calendar is if they correspond to
> Gregorian dates prior to October 1582.
I believe the OP may be interested in the Julian _day_ (civil or astronomical — they differ by half a day), not the month/day/year on Julius Caesar's calendar. This is expressed as a floating point number representing days since an epoch roughly 2,451,545 days before January 1, 2000. The number is is used, for instance, to initialize DateTime objects in Ruby.
<http://en.wikipedia.org/wiki/Julian_day>
I worked the other way around, and slightly differently recently, from HFS creation dates to Julian day. I had to go through a couple of stages of indirection — UTCDateTime to CFAbsoluteTime, then division into days and offset for the difference between epochs (2451911 produced Ruby DateTimes corresponding to what the Finder displayed for those files). I got the epoch offset from the Core Foundation open source for CFDate. It's probably wrong for astronomical purposes, but it did the conversion correctly.
— F
_______________________________________________
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