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

createodbcdatetime problem in cf9

New Here ,
Apr 11, 2012 Apr 11, 2012

Copy link to clipboard

Copied

Hi, im stuck on a problem that i just cannot seem to figure out.

I have a script that recieves popsts from the paypal IPN.

This is my code for decoding the date/time:

<cfif isdefined("form.payment_date")>

       <cfset payment_date=urldecode(form.payment_date)>

       <cfset dl = len(payment_date)>

       <cfset cut = dl - 3>

       <cfset paymentdate_temp=removechars(payment_date,cut,4)>

      <cfset paymentdate = #createodbcdatetime(paymentdate_temp)#>

</cfif>

The script works fine in CF7 and 8 but kicks an error in CF9. I use cfcatch to snag the error. The error is this:

Error at decoding the payment_date, Expression, , 08:38:49 Apr 11, 2012 is an invalid date or time string.

I cannot figure out what to do to save my live. Can someone please help?

Thanks

Tony

Views

804

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 ,
Apr 11, 2012 Apr 11, 2012

Copy link to clipboard

Copied

The documentation for createodbcdatetime says that it takes a date as an argument.  You are sending a string.  The fact that it worked in earlier versions of CF is par for the course.  I've had similar upgrading adventures.

There is another function called parsedatetime that might be more appropriate for your situation.

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 ,
Apr 11, 2012 Apr 11, 2012

Copy link to clipboard

Copied

Hi, Thanks for the reply. So try using parsedatetimne instead of createodbcdatetimne? Or instead of ulrencode?

Tony

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
LEGEND ,
Apr 11, 2012 Apr 11, 2012

Copy link to clipboard

Copied

Why would you be urlDecoding a variable that was POSTed, not GETed (excuse the grammar)?

How is form.payment_date get populated?

--

Adam

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
Community Expert ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

LATEST

WebDevKid wrote:

So try using parsedatetimne instead of createodbcdatetimne? Or instead of ulrencode?

Yes. Why not just

<cfif isdefined("form.payment_date")>

       <cfset payment_date=parseDatetime(form.payment_date)>

</cfif>

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