[EMAIL PROTECTED] (Laurent Therond) wrote in message
news:<[EMAIL PROTECTED]>...
> "R. Martin" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
>
> First, thank you, Russell, for contributing your experience after
> taking the time to read my post. I truly appreciate it.
>
> > If your data is taken at time intervals of days or hours, I'd
> > convert the dates to Julian dates (I can give you a formula if you
> > need it), perhaps subtracting off the earliest just to keep the
> > numbers smaller.
>
> Yes, my data is taken at time intervals of days, although irregular
> intervals. (which certainly makes no difference)
>
> I have stumbled on several references to "Julian dates" since I posted
> my original message.
> These are different things to different people.
> To IBM, the Julian date for this day is 20030206.
> For the makers of Statistica, it's the number of days since January 1,
> 1900.
> For the makers of Origin (another statiscal package), "the Julian day
> zero was over four thousand years ago."
> The list of possible definitions is pretty long...
> This being said, Britannica gave me some good background information
> on the Julian calendar, which is yet something else.
>
> Then, MATLAB handles dates as the number of days since "0-Jan-0000".
> "SPSS actually stores dates as the number of seconds that have elapsed
> since October 14, 1582."
> Stata, on the other hand, considers the number of seconds that have
> elapsed since January 1,1960.
> Etc.
>
> Wow!
>
> Now, I checked the AAVSO Web site and I found:
>
> "Astronomers simplify their timekeeping by simply counting the days.
> All days are numbered consecutively from Julian Day 0, which began at
> noon on January 1, 4713 B. C. January 1st, 1993, was JD 2448989;
> January 1st, 2000 will be JD 2451545."
>
> So, considering this large choice of arbitrary origins, I would really
> appreciate if you could tell me how you compute a Julian date given a
> "normal" date. Since Julian dates seem to be a mystical way to do the
> trick, I might as well join the club. :)
Here are the codes I promised. The first gives you Julian date, the
second gives you day, month and year from the Julian date. They are
in C, but you should be able to find what you need in them, I think.
Regards,
Russell
/*LINTLIBRARY*/
#include <math.h>
#include <stdio.h>
long int julidate(IDAY,IMONTH,IYEAR)
/* */
/* NAME: */
/* julidate */
/* PURPOSE: */
/* calculates the Julian day number for A.D. dates from the day, month, */
/* and year as given by the Gregorian calendar */
/* CATEGORY: */
/* generally useful */
/* ENVIRONMENT: */
/* C language under UNIX */
/* INPUTS: */
/* IDAY - integer day of the month */
/* IMONTH - integer month of the year */
/* IYEAR - integer year number */
/* INTERNAL: */
/* it1 - temporary integer variable used to assure the order of execution */
/* of 2 commutative operators */
/* OUTPUTS: */
/* J - long integer Julian day number that begins at noon UT of the input */
/* date */
/* SUBROUTINES: */
/* none */
/* FUNCTIONS: */
/* none */
/* ALGORITHM: */
/* a formula evaluation */
/* REFERENCES: */
/* Sky & Telescope magazine, August 1991, page 183. */
/* HISTORY: */
/* Written by R. L. Martin. */
/* Last modification date: July 3, 1992 */
/* */
int IDAY, IMONTH, IYEAR;
{
long int J;
int it1;
J = -1;
it1 = 275*IMONTH;
J = (367*IYEAR)-(7*(IYEAR+(IMONTH+9)/12)/4)-
(3*(((IYEAR+(IMONTH-9)/7)/100)+1)/4)+
(it1/9)+IDAY+1721029;
return(J);
}
/*LINTLIBRARY*/
#include <math.h>
#include <stdio.h>
int datefromjuli(J,IDAY,IMONTH,IYEAR)
/* */
/* NAME: */
/* datefromjuli */
/* PURPOSE: */
/* calculates the day, month, and year as given by the Gregorian calendar */
/* from the Julian day number for A.D. dates */
/* CATEGORY: */
/* generally useful */
/* ENVIRONMENT: */
/* C language under UNIX */
/* INPUTS: */
/* J - long integer Julian day number that begins at noon UT of the input */
/* date */
/* INTERNAL: */
/* igreg - long integer variable for the julian date of the start of the */
/* gregorian calender */
/* jalpha - long integer variable for storing intermediate results */
/* ja - long integer variable for storing intermediate results */
/* jb - long integer variable for storing intermediate results */
/* jc - long integer variable for storing intermediate results */
/* jd - long integer variable for storing intermediate results */
/* je - long integer variable for storing intermediate results */
/* jtemp - temporary long integer variable for storing intermediate results */
/* OUTPUTS: */
/* IDAY - integer day of the month */
/* IMONTH - integer month of the year */
/* IMONTH - integer */
/* SUBROUTINES: */
/* none */
/* FUNCTIONS: */
/* none */
/* ALGORITHM: */
/* a series of formula evaluations */
/* REFERENCES: */
/* none */
/* HISTORY: */
/* Modified and translated to C by R. L. Martin from FORTRAN code */
/* Last modification date: Sept. 1, 1994 */
/* */
long int J;
int *IDAY, *IMONTH, *IYEAR;
{
double jtemp;
long int igreg;
long int ja, jalpha, jb, jc, jd, je;
/* initialize */
igreg = 2299161;
*IDAY = -1;
*IMONTH = -1;
*IYEAR = -1;
/* calculate prelimenary values */
if (J >= igreg)
{
jtemp = ((double)(J - 1867216)) - 0.25;
jalpha = (long int)(jtemp / 36524.25);
ja = J + 1 + jalpha - ((long int)(0.25 * jalpha));
}
else
{
ja = J;
}
jb = ja + 1524;
jtemp = ((double)(jb - 2439870)) - 122.1;
jc = (long int)(6680. + (jtemp / 365.25));
jd = (365 * jc) + ((long int)(0.25 * (double)jc));
je = (long int)((double)(jb - jd) / 30.6001);
/* calculate day, month, and year */
*IDAY = jb - jd - (int)(30.6001 * (double)je);
if ((je - 1) > 12) *IMONTH = je - 13;
else *IMONTH = je - 1;
if (*IMONTH > 2) *IYEAR = jc - 4716;
else *IYEAR = jc - 4715;
return;
}
.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
. http://jse.stat.ncsu.edu/ .
=================================================================