How to make a date in ISO 8601 format but be in the same a DateTime [closed]

0

I wanted to know how I can transform a DateTime into an ISO 8601 format but keep it in a DateTime type

    
asked by anonymous 28.08.2017 / 16:39

1 answer

1

This is a form of date representation. A DateTime is a structure that tries to simulate a point in time (a date), as you will represent it the date is not work of this structure itself.

You can use .ToString("o") to represent DateTime in ISO 8601 format.

string dataFormatada = minhaData.ToString("o");

See an example working in .NET Fiddle.

    
28.08.2017 / 16:44