Custom Format Specify in DateTime Format String C#
Whenever we specify / in the DateTime format, it shows and convert the DateTime Separator that is setup in your regional settings.
so DateTime.Now.Date.ToString(@"d/MM/yyyy") will display “3-06-2010” on my pc as my regional setting has “–” as datetime separator.
If you require / in the date (or if you need any char as it is without converting it to Format specified in DateTime) then you need to add escape char before the char you require.
And that is the reason, DateTime.Now.Date.ToString(@"d\/MM\/yyyy") will give you “3/06/2010”
🙂 Happy ProgRaMMing