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

invalid date format Help

New Here ,
Nov 24, 2009 Nov 24, 2009

Good day everyone, I am making a Spanish version of a site where on the first line I am declaring the locale as:

<cfset locale = SetLocale("Spanish (Standard)")>

I am then doing a query to my database where I get a date which I am trying to show like this:

#LSDateFormat(st.INICIO, "mmm/dd/yyyy", locale)#

Where INICIO is the date value from the query named st of the database.

I am getting an error with the following:

08/16/09 is an  invalid date format.

ANy help will be appreciated.

Sincerely,

A not so happy coder today!!!

1.2K
Translate
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 ,
Nov 24, 2009 Nov 24, 2009

What is the datatype of the field in the db?

Translate
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 24, 2009 Nov 24, 2009
  • Microsoft SQL database
  • datetime - data type
  • condensed Data Type = datetime
  • Full-text specification = no
  • Identety Specification = no
Translate
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
Enthusiast ,
Nov 24, 2009 Nov 24, 2009

first off if you're setting the locale via setLocale(), there's no need to pass in the locale for your LS functions especially because what setLocale *returns* is the *old* locale not the one you just set. get it?

Translate
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
Guest
Nov 25, 2009 Nov 25, 2009

I got such problems because the DB return datetime format not supported, a mix between the SQL serveur date time format, modifyed by windows local settings as a result, it swap the mounth and the day, that causes errors when the day was higher than 12. That may be a clue.

Translate
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 25, 2009 Nov 25, 2009
LATEST

Thank you guys, you are correct there was no need for the fsetLocale(), and the problem was on the server config swaping the day and month positions, which was giving the incorrect parameters to the LSDateFormat Function.

ALl I had to do before I called the LSDateFormat() Function was to preformat the dates that the DB sends to the correct format.

Something like this

#LSDateFormat((dateFormat(st.INICIO, "dd/mm/yyyy")),"dd/mmm/yyyy")#

Sincerely,

A happy coder Now....

Translate
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