From: Andy Eskilsson Newsgroups: comp.os.msdos.djgpp,comp.lang.c,alt.sb.programmer,alt.msdos.programmer,comp.os.msdos.programmer Subject: Re: Help with comparing dates Date: 20 Mar 1997 09:24:11 +0100 Organization: Telelogic AB, Sweden Lines: 15 Sender: x-aes AT vega Message-ID: References: <5gq9ar$efi AT ruby DOT ucc DOT nau DOT edu> Reply-To: x-aes AT telelogic DOT se NNTP-Posting-Host: vega.telelogic.se Mime-Version: 1.0 (generated by tm-edit 7.101) Content-Type: text/plain; charset=US-ASCII CC: mdr6 AT dana DOT ucc DOT nau DOT edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp / mdr6 AT dana DOT ucc DOT nau DOT edu (Michael Dylan Ryan) wrote: | Can someone help me with a function to compare two dates. I want to write | a function that will take a date string char *d = "03/01/97" and two other | date strings, start and end, and check to see if d is in between them. | | I have been working with dates for a while and can never get a function to | compare accurately 100% of the time. Any help appreciated. Convert the dates to a tm-struct with the help of strptime, and from there to seconds and compare them.. If you can't find strptime, I have written one in c, can be found at http://www.fukt.hk-r.se/~flognat/hacks/ /Andy