We have Coldfusion installed on Windows Server 2003
A dump of CFDirectory on the undelivered mail returns the following:

But the problem is upon iterating this query, when I dump the date with:
#dateFormat(mailStubs.DateLastModified,'dd-mmm-yyyy')#
This is what I get:
11-Nov-2026
11-Nov-2027
11-Nov-2028
11-Nov-2029
11-Nov-2029
11-Nov-2029
11-Nov-1930
11-Nov-1930
11-Nov-1930
11-Nov-1930
11-Nov-1930
11-Nov-1930
11-Nov-1930
11-Nov-1930
So doing:
datediff("n", mailStubs.DateLastModified, now())
now() being 30th Nov 2011 lets say 2:00 PM gives me very weird results
This only happens on Windows server 2003 (Our production server), it worked fine on my local system (XP)
Any ideas?
I know this is a really old thread, but ... cfdirectory returns a localized date string (not date object). So you should be using the LS (locale sensitive) date functions to parse it. The reason is that the standard CF date functions (DateFormat, ParseDateTime, ...) always use U.S. date conventions. Since the U.S. convention is month first, you will get the wrong results if you pass in a "dd-mm-yyyyy" date string. (At least some of the time.)
<cfscript>
setLocale("en_GB");
WriteOutput( dateFormat(lsParseDateTime("26/11/11 2:42 PM"), "dd-mmm-yyyy") );
</cfscript>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With