views:

1398

answers:

2

How can I convert from a unix timestamp (say 1232559922) to a fractional julian date (2454853.03150).

I found a website ( http://aa.usno.navy.mil/data/docs/JulianDate.php ) that performs a similar calculation but I need to do it programatically.

Solutions can be in C/C++, python, perl, bash, etc...

+3  A: 

The unix epoch (zero-point) is Jan 1, 1970 GMT. That corresponds to the Julian day of 2440587. So in pseudo-code:

function float getJulianFromUnix( int unixSecs )
{
   return ( unixSecs / 86400.0 ) + 2440587;
}
Jason Cohen
You forgot the .5 at the end.The added constant should be 2440587.5
Robert L
A: 

HI

I'm using the UNIX operative system, in SUN server. How I can convert the current day to a Julian date and inversely Julian date to current day, in order to check if the diference between two dates (now and a past date) is >= than 10 days

Thanks in advance

PROCK

PROCK