While trying to input some date variables in an Excel 2000 VBA subroutine, I ran into a curious problem:
My default short date format (according to the Regional and Language Options in the Win XP Control Panel) is dd/mm/yyyy, so that 2 October 2005 should be 02/10/2005, which is the way I want it.
However, I found that 2/10/5 was showing up as 10/02/2005, the way it is in the U.S. But if I input 13/9/5 in the VBA UserForm, it would show up as 13/09/2005 in the Excel spreadsheet, which is correct, as far as I'm concerned. Apparently, if the day of the month is 12 or less, Excel assumes you mean the U.S. format. More than 12, and it decides to use the European forman
I did a workaround by using an If..Then..Else statement, but I find this pretty annoying. Is there a bug in Excel date formats?
My default short date format (according to the Regional and Language Options in the Win XP Control Panel) is dd/mm/yyyy, so that 2 October 2005 should be 02/10/2005, which is the way I want it.
However, I found that 2/10/5 was showing up as 10/02/2005, the way it is in the U.S. But if I input 13/9/5 in the VBA UserForm, it would show up as 13/09/2005 in the Excel spreadsheet, which is correct, as far as I'm concerned. Apparently, if the day of the month is 12 or less, Excel assumes you mean the U.S. format. More than 12, and it decides to use the European forman
I did a workaround by using an If..Then..Else statement, but I find this pretty annoying. Is there a bug in Excel date formats?