www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/20/14:41:23

Date: Thu, 20 Mar 1997 16:39:41 -0300
Message-Id: <1.5.4.16.19970320163220.3827d3c2@dce03.ipt.br>
Mime-Version: 1.0
To: mdr6 AT dana DOT ucc DOT nau DOT edu (Michael Dylan Ryan), djgpp AT delorie DOT com
From: Cesar Scarpini Rabak <csrabak AT ipt DOT br>
Subject: Re: Help with comparing dates

At 03:01 20/03/97 GMT, 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.
>

This somewhat off topic.
Anyway:

Look in the libc info for the functions mktime and difftime. You'll need to
make a function that parses the date string you describe, fill in the
structure mktime requires and them compare the returned values (seconds
since the epoch date).

This should give you the result you look for.


>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.
>
>--
>Michael D. Ryan [Dark Brotherhood Software]
>Email: dbrotherhood AT geocities DOT com
>       mdr6 AT dana DOT ucc DOT nau DOT edu
>       TheShogun AT aol DOT com
>Programming Page:  http://www.geocities.com/SiliconValley/Pines/5301/
>--
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak                      E-mail: csrabak AT ipt DOT br
DME/ASC                                   Phone: 55-11-268-3522 Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax:   55-11-268-5996
Av. Prof. Almeida Prado, 532.  Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019