Is there any way in .Net I can get the default format used by DateTime.ToString() to change from ToString(“G”) to ToString(“o”)?
I don’t have the option of using a different overload it has to be ToString().
Update:
I found a way to do what I need using DateTimeOffset but it was very useful to see Gonzalo’s solution.
This is the closest I could get. The only problem is that there’s a space between the date and the T:
The output was: