Default locale

We’re trying to track down a formatting change, where it looks like we expect the implicit locale to be en_GB, or at least dd-mm-yyyy for (ls)dateformat(), but it no longer is.

I’ve read Date and Time Formatting in Lucee :: Lucee Documentation which explains the default locale comes from .CFConfig.json then Application.cfc, then runtime.

Suppose I do not specify any of those locations - where does the default locale come from then ? Does Lucee fall back to checking some environment variable or JVM setting or something ?

Thanks for the report. To help track this down, could you share the Lucee version where you noticed the change, whether locale is set in .CFConfig.json or Application.cfc (and to what), and a short example of the LSDateFormat/DateFormat call plus the unexpected output?

Sorry if I wasn’t clear, I’m not setting locale at all. getLocale() (Dockerised v6.x) is returning english (us) and I want to understand why.

writedump(getLocale())

f='dd/mmm/yyyy H:nn'
str='02/01/2026 03:04'
writeDump(str)
writedump(isDate(str))
writedump(dateTimeFormat(str,f))

writedump(lsdateTimeFormat(str,f,'en-gb'))
writedump(setLocale('english (united kingdom)'))
writedump(getLocale())
writedump(lsdateTimeFormat(str,f,'en-gb'))
writedump(lsdateTimeFormat(str,f,'english (united kingdom)'))
writedump(lsdateTimeFormat(parseDateTime(str),f,'en-gb'))
writedump(lsdateTimeFormat(lsparseDateTime(str),f,'english (united kingdom)'))

This outputs the below, and I think it didn’t use to require the lsparsedatetime, as if the default locale was UK English, or at least UTC. But I’m having a hard time working back through both our past releases, and past Lucee releases to find any change, if there is one !

string	english (us)
string	02/01/2026 03:04
boolean	true
string	01/Feb/2026 3:04
string	01/Feb/2026 3:04
Locale english (us)
Code (ISO-3166)	en_US
Country	United States
Language	English
string	english (uk)
string	01/Feb/2026 3:04
string	01/Feb/2026 3:04
string	01/Feb/2026 3:04
string	02/Jan/2026 3:04

And, as a more concise test

writedump(getLocale())
writedump(setLocale('english (united kingdom)'))
writedump(getLocale())

f='dd/mmm/yyyy H:nn'
str='02/01/2026 03:04'
writeDump(str)
writedump(isDate(str))
writedump(dateTimeFormat(str,f))
writedump(lsdateTimeFormat(str,f))

This should set the locale to UK, then print a date in January, but both dates print as being in Feb

string	english (us)
Locale english (us)
Code (ISO-3166)	en_US
Country	United States
Language	English
string	english (uk)
string	02/01/2026 03:04
boolean	true
string	01/Feb/2026 3:04
string	01/Feb/2026 3:04

dateTimeFormat() seems to be parsing the string according to US conventions ?
It’s docs (currently) say it “formats according to US”, and doesn’t say anything about it’s parsing of strings.

The formatting isn’t the problem here, the parsing of the string is. When you pass a string to a formatting function like dateTimeFormat() or lsDateTimeFormat(), the function first has to turn it into a date. The default conversion always reads a pattern like 02/01/2026 US style, month first, whatever locale is set. Every past Lucee and Railo version behaves this way, and so does ACF, so this isn’t something we can change.

The fix is to parse strings like this explicitly with the locale-aware function, and only then format the result:

str = "02/01/2026 03:04";
d = lsParseDateTime(str, "en_GB"); // or set the locale and call lsParseDateTime(str)
writeOutput(dateTimeFormat(d, "dd/mmm/yyyy H:nn")); // 02/Jan/2026 3:04

That said, I’ve been thinking for a while that Lucee should let you choose which parser is used by default for these implicit conversions: the simple one used today, or one that respects the locale. Then a string passed to dateTimeFormat() would be read the way your locale expects. That would be a new opt-in setting, so the current behaviour stays the default.

On your original question: when no locale is set in .CFConfig.json or Application.cfc, Lucee uses the JVM’s default locale. In a Docker container that’s usually en_US. You can change it with this.locale = "en_GB"; in Application.cfc, with "locale": "en_GB" in .CFConfig.json, or on the JVM with -Duser.language=en -Duser.country=GB.

Michael asked me to create a ticket for the default date parser setting he suggested above, so here it is: LDEV-7006

It covers an opt-in setting to choose between the simple default parser and a locale-aware one, with the current behaviour staying the default.