DatePart invalid in UK
Day of week is displayed incorrectly, as if the date is in US format mm/dd/yyy. How can I fix this?
(UK format is dd/mm/yyyy)
eg
Datepart for 01/05/2002 returns value of 7 for Saturday (not 4 for Wednesday).
UK : 01/05/2002 = 1 May 2002 = Wednesday.
US : 01/05/2002 = 5 Jan 2002 = Saturday.
More puzzling is that Datepart for 21/04/2022 returns 5 (for Thursday), when it should return 1 for Sunday, and in a US format a month of "22" is not valid anyway.
From my test output :
01/05/2002 Wed is output as datepart & day of week : 7 day of week Saturday
21/04/2022 Sun is output as datepart & day of week : 5 Thursday
22/04/2022 Mon is output as datepart & day of week : 6 Friday
23/04/2022 Tue is output as datepart & day of week : 7 Saturday
24/04/2022 Wed is output as datepart & day of week : 1 Sunday
25/04/2022 Thu is output as datepart & day of week : 2 Monday
26/04/2022 Fri is output as datepart & day of week : 3 Tuesday
27/04/2022 Sat is output as datepart & day of week : 4 Wednesday
My investigation so far :
The fault lies with the command "datepart" (ColdFusion not SQL), when used with command "DayOfWeekAsString".
Window Servers that run ColdFusion are set for UK in Control Panel settings.
Test logic of "Locale #GetLocale()#" displays "Locale English (UK)"
In JVM parameters the language is "-Duser.language=en" (should this be set to en_GB?)
I can workaround it by setting up day of week number in SQL and passing that to CF logic, but this is just avoiding the problem.
