Skip to main content
Inspiring
Dec 9, 2011 1:19 PM UTC
Question

CFIMAP and date formats

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

Participant
Nov 12, 2012 11:11 AM UTC

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! 

Translate
Inspiring
Dec 9, 2011 3:04 PM UTC

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.

Translate