I would accept a patch with tests to LocalDate for conversion to/from
ModifiedJulianDays, but not Julian (as Julian days start at 12:00,
which isn't very helpful).

To patch, download the source code from svn, edit it, and then use
"create patch" in svn/Eclipse to create the patch. tests are needed
too!

Stephen


On 1 November 2010 02:44, David Alvarez Debrot <dalva...@iccube.com> wrote:
> We're currently using JodaTime and it would be very handy for us to have the
> conversion to julian dates.
>
> Is somebody working on this ? if no is there an easy way* to contribute to 
> joda
> project (find above the conversion code - ) ?
>
> -David
>
> P.S.: *I don't know how easy it is to add code to Joda trunk..
>
> -> code :
>
>
>  protected static int toJulianDate(int day, int month, int year)
>    {
>        final int m1 = (month - 14) / 12;
>        final int y1 = year + 4800;
>        final int julian = (1461 * (y1 + m1) >> 2)
>                           + (367 * (month - 2 - 12 * m1) / 12)
>                           - ((3 * ((y1 + m1 + 100) / 100)) >> 2)
>                           + day - 32075;
>        return julian;
>    }
>
>  protected static LocalDate toLocalDate(final int julianDate)
>    {
>        final int pp = julianDate + 68569;
>        final int qq = (pp << 2) / 146097;
>        final int rr = pp - ((146097 * qq + 3) >> 2);
>        final int dd = 4000 * (rr + 1) / 1461001;
>        final int tt = rr - ((1461 * dd) >> 2) + 31;
>        final int uu = 80 * tt / 2447;
>        final int vv = uu / 11;
>        final int year = 100 * (qq - 49) + dd + vv;
>        final int month = uu + 2 - 12 * vv;
>        final int day = tt - 2447 * uu / 80;
>        final LocalDate ymd = new LocalDate (year, month, day);
>        return ymd;
>    }
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to