• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFIMAP and date formats

Contributor ,
Dec 09, 2011 Dec 09, 2011

Copy link to clipboard

Copied

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.

TOPICS
Advanced techniques

Views

899

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 09, 2011 Dec 09, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 12, 2012 Nov 12, 2012

Copy link to clipboard

Copied

LATEST

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! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation