🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7356

Re: Manipulating Dates

#7356
From: Giving C News a *HUG*
Date: Wed, 26 Jun 1991 14:24
24 lines
1272 bytes
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

difftime() /* Divide by 60*60*24 to get the difference in days */

>                                     (or maybe compute the date to a
> "serial" date like Excel does--number of days from 1/1/1900).

time() /* Divide by 60*60*24 to get the number of days since 1970-01-01 */

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

gmtime() /* Look at the tm_wday field of the returned structure */

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

Try looking up the standard "time.h" library calls in the manual?


mathew

 
Technical Details
Message-ID: <oJk642w164w@mantis.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!uunet!mcsun!ukc!slxsys!ibmpcug!mantis!mathew
References: <1991Jun25.205213.2693@beaver.cs.washington.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!uunet!mcsun!ukc!slxsys!ibmpcug!mantis!mathew
From: mathew@mantis.co.uk (Giving C News a *HUG*)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Manipulating Dates
Keywords: date
Message-ID: <oJk642w164w@mantis.co.uk>
Date: 26 Jun 91 14:24:35 GMT
Article-I.D.: mantis.oJk642w164w
References: <1991Jun25.205213.2693@beaver.cs.washington.edu>
Organization: Mantis Consultants, Cambridge. UK.
Lines: 24