[Solved] Getting specific datetime format in C#


Something like this?

string output = DateTime.Now.ToString("yyyy-0MM-ddTHH:mm:ss:fffZ");

I’m not sure about the “Z”, if you wanted some time zone info. I zero padded the month like your example. Obviously there would never be a needed third decimal place.

1

solved Getting specific datetime format in C#