J
jim kane
I'm trying to use com to format an Excel column as a date in window's short
date format.
It works for most regional settings but not Norwegian(Bokmal).
To test this I set my regional settings to Norwegian(Bokmal) in control
pannel. ( I have US windows xp and excel 2003 )
I call GetLocaleInfoW() to get the regional window's short date setting and
it returns 'dd.MM.yyyy' which is correct I believe.
I then set the NumberFormat Property of the Excel Column object to
'dd.MM.yyyy' by converting the unicode received from GetLocaleInfoW to a
bstring.
To my surprise a date such as 12 January 2006 appears in that column as
12.01.yyyy instead of 12.01.2006 as I expected.
using the NumberFormatLocal format produced the same result.
It appears that when regional settings are set to Norwegian(Bokmal) 'yyyy'
is not the correct date formating code for the year portion of the date.
If anyone can point me in the right direction on how to format a column for
the window's short date format for various regional settings, I'd greatly
appreciate it. using the date string from GetLocaleInfoW() isnt a useful
approach.
I was hoping there was a format string that allowed setting the date format
for a column to the window's short date format without having to construct a
string such as 'dd.MM.yyyy' which appears problematic.
Jim Kane
date format.
It works for most regional settings but not Norwegian(Bokmal).
To test this I set my regional settings to Norwegian(Bokmal) in control
pannel. ( I have US windows xp and excel 2003 )
I call GetLocaleInfoW() to get the regional window's short date setting and
it returns 'dd.MM.yyyy' which is correct I believe.
I then set the NumberFormat Property of the Excel Column object to
'dd.MM.yyyy' by converting the unicode received from GetLocaleInfoW to a
bstring.
To my surprise a date such as 12 January 2006 appears in that column as
12.01.yyyy instead of 12.01.2006 as I expected.
using the NumberFormatLocal format produced the same result.
It appears that when regional settings are set to Norwegian(Bokmal) 'yyyy'
is not the correct date formating code for the year portion of the date.
If anyone can point me in the right direction on how to format a column for
the window's short date format for various regional settings, I'd greatly
appreciate it. using the date string from GetLocaleInfoW() isnt a useful
approach.
I was hoping there was a format string that allowed setting the date format
for a column to the window's short date format without having to construct a
string such as 'dd.MM.yyyy' which appears problematic.
Jim Kane