Date and time format changes in Visual Studio

When working in Visual Studio 2005/2008/2010/1012/2013, dates and times are displayed in the format mm / dd / yyyy hh: MM: ss. Is there a way to change it to the same settings as the computer?

The date that interests me is in the Clock window. My system is in English, but the installation of Visual Studio 2005 is in English. Therefore, even when I have a different date format, this parameter does not affect VS.

TooltipQuickwatch 1Quickwatch 2

Computer clock

Computer settings

+6
visual-studio visual-studio-2013 visual-studio-2010 visual-studio-2012
source share
4 answers

This behavior is built into the debugger; in a specific case, it debugs a program written in VB.NET. Visible with # in the screenshot. It's okay unusual, in many cases the debugger makes efforts to make its conclusion the same as the way you wrote it in the program. Take C #, for example, a string containing embedded double quotes will be displayed with backslashes in front of them. Actually not present in the string, but necessary when you declare such a string literal in the source code.

So, VB.NET language rules apply to the format of the string you see. Described in chapter 2.4.6 Language Specifications, this is not culture sensitive. Of course, this cannot be, your source code is not going to release another program when your colleague in China compiles it. I just copy / paste the production rules:

 DateLiteral ::= # [ Whitespace+ ] DateOrTime [ Whitespace+ ] # DateOrTime ::= DateValue Whitespace+ TimeValue | DateValue | TimeValue DateValue ::= MonthValue / DayValue / YearValue | MonthValue – DayValue - YearValue TimeValue ::= HourValue : MinuteValue [ : SecondValue ] [ WhiteSpace+ ] [ AMPM ] | HourValue [ WhiteSpace+ ] AMPM MonthValue ::= IntLiteral DayValue ::= IntLiteral YearValue ::= IntLiteral HourValue ::= IntLiteral MinuteValue ::= IntLiteral SecondValue ::= IntLiteral AMPM ::= AM | PM 

Thus, it is always a month / day / year. If you need to see how it looks when you convert it to a string, you should use the appropriate string conversion in the time zone expression. For example, CStr(Date.Now) etcetera, be careful there are many ways to do this, because DateTime.ToString () can accept formatting characters.

+3
source share

Since Benjol suggested that specifying where you see the date would be better, but wherever the date and time are shown, I put my money on this answer:

Dates are displayed in this format because you told him to do it. More specifically, these are the date formatting options in the operating system that govern most places, including Visual Studio.

To confirm this, change the formatting options (Control Panel> Regional Settings) of the date date and see if it works.

0
source share

Given that only .ToString () is affected, are you sure that

Thread.CurrentThread.CurrentCulture

not redefined or used differently than Swedish culture?

0
source share

In the "Control Panel \ All Control Panel Items \ Region and Language" on the "Formats" tab, click the "Advanced Settings ..." button. The Visual Studio 2008 debugger formats dates using the Short Date: option on the Date tab in Customize Format.

Format setting

Quickwatch

0
source share

All Articles