Displaying Dates in VS 2010

From time to time there’s discussion about the way dates are displayed in the Visual Studio IDE for Visual Basic. Typically dates are shown using VB’s date literal syntax of #MM/dd/yyyy# which is the standard US format.  For people outside of the USA this can be confusing or ambiguous at times.  The good news is Visual Studio allows you to easily add your own display formatter.

Simply create a new class library project, add the following attribute to your AssemblyInfo file:

<Assembly: DebuggerDisplay(“Date: {ToString(“”s””)}   kind={Kind}”, Target:=GetType(DateTime))>

And then just copy the assembly to your Visualizers directory, eg:
  My Documents\Visual Studio 2010\Visualizers

I added the Kind property to the display so as you can easily see if the Date is a local date, UTC or unspecified.

I’ve attached a sample project.  Enjoy Smile