I am creating a custom type DateOnly which is effectively a DateTime with the Time portion removed.
I have run into a small problem where I want to format the Value of my new type like a date:
Dim startDate As New DateOnly(2012, 1, 2)
Debug.WriteLine(String.Format("{0:ddd}", startDate))
This outputs: 02/01/2012, I want to be able to format this to be Mon
Note: I haven’t included any of my code for the DateOnly type (to keep things simple) but I can add it if requested
I have managed to answer my own problem by implementing
IFormattablein my custom type:This seems to do the trick.