|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
createodbcdatetime change in ColdFusion 9?
Hi, im stuck on a problem that i just cannot seem to figure out.Tony Paolillo 04/11/12 12:20 P Tony,Russ Michaels 04/11/12 12:31 P >Tony,Tony Paolillo 04/11/12 01:32 P I saw the same thing Russ saw in your code. The variable "payment_date"Cameron Childress 04/11/12 01:12 P Are you using CFFORM?Claude_Schnéegans 04/11/12 01:17 P > Are you using CFFORM?Tony Paolillo 04/11/12 01:33 P >>The data is actually being posted back from paypal.Claude_Schnéegans 04/11/12 01:42 P turn on FULL debug output in your cfadmin and it should give you moreRuss Michaels 04/11/12 01:47 P >turn on FULL debug output in your cfadmin and it should give you moreTony Paolillo 04/11/12 01:53 P > >>The data is actually being posted back from paypal.Tony Paolillo 04/11/12 01:54 P What is the actual content of the form.payment_date coming from PayPal?morgan lindley 04/11/12 02:36 P >What is the actual content of the form.payment_date coming from PayPal?Tony Paolillo 04/11/12 02:48 P What I was saying is, I tested the actual code you originally posted on CF9morgan lindley 04/11/12 03:26 P Thank you for your help. I just added this code into a simple cf page:Tony Paolillo 04/11/12 03:46 P That needs to be:morgan lindley 04/11/12 03:54 P 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 Tony, which line does that error occur on ? the error doesn't really make sense with the code supplied as the only line where you are doing anything with payment_date is <cfset payment_date=urldecode(form.payment_date)> and this is not doing anything date/time related. Are you sure this error is not occuring elsewhere or that you are referencing payment_date somewhere rather than paymentdate_temp ----- Excess quoted text cut - see Original Post for more ----- ----- Excess quoted text cut - see Original Post for more ----- The error occors on the line with createodbcdatetime. I added in a cffile to write soemthing to a file at each line for me to trace where the error occored and it made it all the way to the createodbcdatetime line and then kicked the error.. It doesent make sense to me why on CF9 but not any previous versions. I saw the same thing Russ saw in your code. The variable "payment_date" and "paymentdate" are named similarly, but are not the same. The error appears to be thrown on "payment_date", which doesn't appear to interact with createodbcdatetime() in your example code at all. -Cameron ----- Excess quoted text cut - see Original Post for more ----- Are you using CFFORM? I never use it, but I kind of remember there is something special witf input fields containing "_date". > Are you using CFFORM? > I never use it, but I kind of remember there is something special witf > input fields containing "_date". The data is actually being posted back from paypal. Paypal posts to my page with all the transaction vars and i parse them. The script was created by a much more advanced coder than myself and i cant seem to find the problem now. >>The data is actually being posted back from paypal. Ok, I see. Well the problem is that CF is not able to parse the date in the format supplied by Paypal. Personally, I use createODBCDateTime(Now()) to register the date time. It will be the time related to your sever instead of Paypal's one, but it should be accurate enough. turn on FULL debug output in your cfadmin and it should give you more detail as well as exact line number for the error, in fact a try/catch will do this also. no create a page with a form that posts the exact same data as paypal, and you can use this to debug rather than waiting for paypal. On Wed, Apr 11, 2012 at 6:41 PM, <> wrote: ----- Excess quoted text cut - see Original Post for more ----- ----- Excess quoted text cut - see Original Post for more ----- Actually, this is the error from cftry/cfcatch: Error at decoding the payment_date, Expression, , 08:38:49 Apr 11, 2012 is an invalid date or time string. I did create a local script and recieved the same error, then i removed the time from the paypal post string and it worked. What i dont understand is why does it work on CF8 and not CF9. Also, lets say i can remove the time from the post, how can i do that? which line? I tried createodbcdate and still got the same error. Thanks > >>The data is actually being posted back from paypal. > > Ok, I see. Well the problem is that CF is not able to parse the date > in the format supplied by Paypal. > Personally, I use createODBCDateTime(Now()) to register the date time. > It will be the time related to your sever instead of Paypal's one, but > it should be accurate enough. Ill try that also.. thanks What is the actual content of the form.payment_date coming from PayPal? It should be something like '08:38:49 Apr 11, 2012 PDT'. The code below works just fine on that value on CF9 in my testing environment. Without the ' PDT' part, the code tries to run createodbcdatetime() on '08:38:49 Apr 11, ', which fails. ----- Excess quoted text cut - see Original Post for more ----- ----- Excess quoted text cut - see Original Post for more ----- Im sending this in my test and it fails: "08:38:49 April 11, 2012 EST". If i take out the time and have this "Apr 11, 2012 EST" It works. I noticed that the date im trying to create an odbc datetiime on is "08:38:49 Apr 11, 2012" and its failing.. That still has the time in it but not the EST. So are you saying i should take off the "cut" in my code and leave the EST on? Thanks What I was saying is, I tested the actual code you originally posted on CF9 with 08:38:49 Apr 11, 2012 PDT as the input and it works fine. I was trying to verify that the data you're working with has the timezone on the end, since the "cut" portion of the code is designed to remove that, and will remove needed data if your input doesn't include it. I just tested again with 08:38:49 April 11, 2012 EST, and your original code also works. Removing the "cut" won't fix your trouble, because 08:38:49 April 11, 2012 EST isn't a valid date/time string for CF. I used this for my testing: <form method="post"> <input type="text" name="payment_date" value="08:38:49 Apr 11, 2012 EST " /> <button>Post</button> </form> <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)#> <cfdump var="#paymentdate#"> </cfif> I noticed that the date im trying to create an odbc datetiime on is > "08:38:49 Apr 11, 2012" and its failing.. That still has the time in it but > not the EST. > This should work fine: <cfdump var="#createodbcdatetime('08:38:49 Apr 11, 2012')#"> You may be running into an ambiguity issue with CF being type-less. Createodbcdatetime() wants a DateTime object but will accept a string CF thinks it can parse. For my test environment, CF can parse the string you have, but it seems your server environment can't. I can't say for sure why, and getting into the server settings isn't really something I have a lot of experience with. Thank you for your help. I just added this code into a simple cf page: <cfset paymentdate = #createodbcdatetime('08:38:49 April 11, 2012 EST')#> and i get an error just loading the page: "Parameter validation error for the CREATEODBCDATETIME function. The value of parameter 1, which is currently 08:38:49 April 11, 2012 EST, must be a class java.util.Date value." Must be on the server end because it works accross my testing server also. The server is a hosting server in the UK so i dont know if they have something setup differently. Ill have to contact them. Thanks for your help. Tony That needs to be: <cfset paymentdate = #createodbcdatetime('08:38:49 April 11, 2012')#> The time zone on the end is invalid in CF. > <cfset paymentdate = #createodbcdatetime('08:38:49 April 11, 2012 EST')#>
|
May 25, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||