From: richard AT stardate DOT bc DOT ca (Richard Sanders) 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: 29 Mar 1997 22:09:14 GMT Organization: Your Organization Lines: 15 Message-ID: <5hk3ua$4tb$1@news.rapidnet.net> References: <5gq9ar$efi AT ruby DOT ucc DOT nau DOT edu> <5gtf0l$lk3$1 AT opera DOT iinet DOT net DOT au> NNTP-Posting-Host: wlp29.rapidnet.net Mime-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp > 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. > I find that converting a date to the UNIX 'date and time' long number format, an easy way to deal with dates. Easy to compare, easy to add/subtract n day(s) and easy to convert back into a conventional date format because most c libs have functions to do this. Cheers Richard