Skip to main content
Inspiring
December 9, 2011
Question

CFIMAP and date formats

  • December 9, 2011
  • 2 replies
  • 952 views

I did a WEBMAIL using CFPOP.

I want now to use CFIMAP,

but when checking date (sentdate), I have a problem :

I use function isDate(sentdate), it is OK, pass

I then I use ParseDateTime with POP attribute

<cfif isDate(sentdate)>

     <cfset l_date=ParseDateTime(sentdate,"pop")>

I get an error :

{ts '2011-12-09 14:03:53'} is not a valid date format

How to get a valid date with this ?

It did work with CFPOP and variable "date"

Thanks for any suggestion about this change of date format

between CFPOP and CFIMAP.

What do I need to use to get a valid date with CFIMAP and "sentdate" ?

Pierre.

This topic has been closed for replies.

2 replies

Participant
November 12, 2012

Taking out the "Pop" solved the issue with dates in the format you quote, although I think ParseDateTime will then fail on the more typical pop format, which has -0500 or some such after the date and time.  <cftry> is the soverign remedy for issues like this but it's a pain in the neck that ParseDateTime isn't smarter.  It's not brain surgery to parse the date whether or not it has -0500 after it! 

Inspiring
December 9, 2011

DateFormat() formats dates.

Be careful with isDate().  Sometimes it returns the wrong answer.  Also make sure that validating the date is necessary.  If the string came from a user, validate it.  If it came from something that only returns dates validation is a waste of processing.