Skip to main content
Participant
September 2, 2009
Question

LSParseDateTime error

  • September 2, 2009
  • 2 replies
  • 1528 views

Hi

I keep getting an error when trying to parse a date using LSParseDateTime on a CF7 server. If I test the same code locally (CF8 developer) it works fine.

This is the code:

<cfset temp = SetLocale("English (UK)")>

<cfset tdate = "Wed, 26 Aug 2009 21:10:11 +0000">

<cfoutput>
Locale = #GetLocale()#
<br />
IsDate #IsDate(tdate)#
<br />
Parse #ParseDateTime(tdate)#
<br />
LS Parse #LSParseDateTime(tdate)#

</cfoutput>

The code gives the error

"Wed, 26 Aug 2009 21:10:11 +0000" is an invalid date or time string."

Does anyone have any idea how to fix this?

Thanks

Paul

    This topic has been closed for replies.

    2 replies

    Inspiring
    September 3, 2009

    "Wed, 26 Aug 2009 21:10:11 +0000" fails on both cf8 & cf9 for my servers using

    locale "en_US". it works when i set the locale to "en_GB", so i guess that's the

    difference between your cf8 & cf7 servers?

    dawilsAuthor
    Participant
    September 3, 2009

    Hi Paul

    Thanks for checking on your server.

    I had a look at the Java locale settings in the CF Admin for both machines:

    CF7 is "en_US" (not working)

    CF8 is "en_GB" (working)

    Looks like you could be onto something. How can I change the local to "en_GB" on the CF7 server?

    Thanks

    Paul

    Inspiring
    September 3, 2009

    first better check whether you should be changing the server's locale...you can

    just do a setLocale("en_GB") on the pages that need it or in the

    application.cfm/cfc to make cf use en_GB w/out bothering the rest of the box.

    if you do go ahead then find you jvm.config & add

    -Duser.language=en -Duser.region=GB

    to java.args. stop & restart the cf server service.

    just note that you'll see some quirks (in cfdirectory, cfschedule, log files,

    etc.) when you get datetime data from the OS if it's not the same locale as cf.

    Inspiring
    September 3, 2009

    I don't have a CFMX7 server to test on, so cannot verify anything I suggest before suggesting it I'm afraid.

    What happens if you lop the "Wed, " off?

    --

    Adam