Re: HELP - Convert julian date to gregorian?
Date: 1995/11/22
Message-ID: <49034v$l85_at_eccdb1.pms.ford.com>#1/1
This takes the date starting from 16-NOV-1989
This works on Hpunix and localtime() is on unix.
long g_date[3]; should be declared in the calling
program. So, we are using 20*365..... You can
modify for your need accordingly.
#include <time.h>
void format_date (short j_date, long g_date[])
Hope this helps.
Srinivasa Chareddy
{
long tim_val; /* time in seconds */
struct tm *tme; /* time structure */
tim_val = j_date * 60 * 60 * 24 + ((20 * 365) - 40) * 60 * 60 * 24;
tme = localtime (&tim_val);
g_date[0] = (tme->tm_mon) + 1; /* convert to Gregorian date */
g_date[1] = tme->tm_mday;
g_date[2] = tme->tm_year;
}
scharedd_at_ba0023.ba.ford.com
Received on Wed Nov 22 1995 - 00:00:00 CET