0

We have migrated from ColdFusion 2011 to ColdFusion 2018 AND getting below errors.

Error Message - 04-Feb.-2019 10:16 am is an invalid date or time string.

After doing some debugging found that the CF method LSDateFormat(now()) returns 04-Feb.-2019 07:19 am and all earlier versions it is returning 04-Feb-2019 07:19 am. The difference is adding a dot after the month abbreviation.

Please let me know if you have come across such DateTimeissues with ColdFusion 2018 migration.

Thanks, Manjeet

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • 2
    `LSDateFormat` is not known to return a time part. Is it actual code you are posting or a simplification? – Bernhard Döbler Feb 04 '19 at 12:29
  • 2
    Also, what function is throwing that error? What is the Locale of the JVM? – SOS Feb 04 '19 at 13:52
  • 1
    Add `setLocale("en_US")` on the first line of the same page, just to check if your current system locale (JVM) is adding the dot issue. – Alex Feb 04 '19 at 19:33
  • I have tried with setLocale("en_US") but it didn't fix the problem. LSDateFormat only format the dates and there is the issue when it tries to format according to the locale setting of the client computer. When I ran with CF2011, It returns correct date format without a dot. – Manjeet Mahto Feb 05 '19 at 06:57
  • You didn't answer the questions above - 1. Which locale? 2. Is that the actual/full code? I tried a bunch of locales with the code above and none produced an extra dot - or time - suggesting your real code is different thzn what you posted ... Could you please post a real example? – SOS Feb 05 '19 at 13:59
  • I just tried ` #LSDateFormat(now())#` on cffiddle and it returned "Feb 6, 2019" without any dots. Check your code, the dot is coming from your data – volume one Feb 06 '19 at 17:53
  • @volumeone - I agree it's VERY likely the code is the problem (not the function), but ..strictly speaking that one test alone isn't a guarantee since the site is probably using a different Locale - which will affects the output. – SOS Feb 06 '19 at 21:18
  • Are you using CF2018? As this issue is working with below versions. – Manjeet Mahto Feb 07 '19 at 11:52
  • @ManjeetMahto just to go https://cffiddle.org and copy and paste my code above. It is running CF2018 by default. – volume one Feb 07 '19 at 12:26
  • What is your locale? – SOS Feb 07 '19 at 15:48

0 Answers0