This code should help you out.

You can compare the dates down to the second.
The function datecompare has an optional parameter (It's the precision of
the comparison)

The parameter can have any of the following values:
  s    Precise to the second
  n    Precise to the minute
  h    Precise to the hour
  d    Precise to the day
  m    Precise to the month
  yyyy    Precise to the year


<cfdirectory action="list" filter="*.*" directory="c:\" name="directory">

<cfoutput query="directory">
<cfscript>
        // set your date either dynamically or statically below
        mydate = now();

        // compare mydate to directory.datelastmodified
        comparison = datecompare(dateformat(mydate,'m/dd/yyyy'),
dateformat(datelastmodified,'m/dd/yyyy'));
</cfscript>

<!--- output results of comparison --->
<cfif comparison eq -1>
        date1 is less than date2
<cfelseif comparison eq 0>
        date1 is equal to date2
<cfelseif comparison eq 1>
        date1 is greater than date2
</cfif>
<br>
</cfoutput>



Joseph DeVore
VeloxWeb Technologies




-----Original Message-----
From: Paige Chandler [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 24, 2001 5:36 PM
To: CF-Talk
Subject: Comparing Dates Functions


Hello All,

I'm having difficulty comparing a date range to DateLastModified,
returned from CFDirectory. I've explored most of the date functions but
can't find the function and syntax to do the job. Any help would be
appreciated. TIA. Have a nice day.

Regards,

Paige


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to