[alt.msdos.programmer] Manipulating Dates

goble@cs.washington.edu (Brian Goble) (06/26/91)

I need some C code to maniuplate dates.  I need to be able to compute
the number of days between 2 dates (or maybe compute the date to a
"serial" date like Excel does--number of days from 1/1/1900).

I also need to be able to determine what day of the week a given day
is (e.g. Tuesday).

Any code or pointers to code would be much appreciated...thanx.


Brian Goble	|	goble@wolf.cs.washington.edu

rsimpkin@javelin.sim.es.com (Roger Simpkins) (06/27/91)

goble@cs.washington.edu (Brian Goble) writes:


>I need some C code to maniuplate dates.  I need to be able to compute
>the number of days between 2 dates (or maybe compute the date to a
>"serial" date like Excel does--number of days from 1/1/1900).

>I also need to be able to determine what day of the week a given day
>is (e.g. Tuesday).

	ALL of the above functions contained in any ANSI C compiler.  Try
looking at time(), difftime(), asctime() and you may have some sucess.

HARVEY@SLACVM.SLAC.STANFORD.EDU (06/27/91)

NONE OF THE FUNCTIONS YOU MENTIONED WILL COMPUTE DAYS BETWEEN DATES THAT
GO PAST 1 MONTH. I HAD THIS PROBLEM A COUPLE OF MONTHS AGO AND I RECEIVED
A LOT OF SOURCE FROM THE NETWORK. IF YOU EMAIL ME DIRECTLY I WILL
DIG OUT THE SOURCE FOR YOU.

HARVEY@SLACVM