Thanks a lot for the suggestion! Yes, converting string-to-date-object , using LSDateFormat() though, works fine. It’s just like a hacky way though which does the thing.
Basically, I have a string, of ‘10/08/2018’. If I do an LSDateFormat(‘10/08/2018’,‘dd’) I can get the correct day (=10).
If I do a day() this will return an 8.
So, all dates should go through LSDateFormat.
It would be good if lucee had a global setting to set the locale of all date functions, such as month(), day(), DateAdd(), DateDiff(), etc.
but your recommendation simply works, thank you!
George
The regular date function are all EN_US locale based, so this function do not care about the current locale set in the environment. So best always use the “ls” function instead if they are existing or make sure you are passing a date object (convert it before) and not passing a string.
I have somewhere a spreadsheet that shows which function “ls” matching the regular date function, i will search for it.
We should consider filling the gaps of the missing ls functions, in that case at least “lsDatePart”.
i did digg a little bit deeper into this.
“ls” function that convert a date to a string like regular date function as well.are expecting a date as input.
So your string gets converted to a date BEFORE it is passed into for example the “Day” function.
So “lsDay” would make no difference on this. So if you have a string and want it converted to a date, do it explicitly otherwise it is always US locale based. So use paseDateTime for example instead.
We should consider a global setting and application.cfc setting influence this behaviour.