0
I wanted to know how I can transform a Datetime into an ISO 8601 format but keep it in a type of Datetime
0
I wanted to know how I can transform a Datetime into an ISO 8601 format but keep it in a type of Datetime
1
This is a form of representation of the date. A DateTime
is a structure that tries to simulate a point in time (a date), as you will represent it date is not work of this structure itself.
You can use a .ToString("o")
to represent a DateTime
in ISO 8601 format.
string dataFormatada = minhaData.ToString("o");
Browser other questions tagged c# date
You are not signed in. Login or sign up in order to post.
but so it won’t stay in string?
– Pedro Azevedo
Youthful, one
DateTime
has no format. It’s a structure, you format to show, to serialize, something like that.– Jéf Bueno
Exactly but there is no possibility to keep in Datetime ?
– Pedro Azevedo
No, man. A Datetime has no format. You will format when you need.
– Jéf Bueno
How do I stop in an httpWebRequest.Date say that the date has to have this formatting ?
– Pedro Azevedo
This is a header that is sent in the request. It is formatted with a specific format (see documentation:
The classes in the System.Net namespace always write it out the Date property on the wire during transmission in standard form using GMT (Utc) format.
). So, if you want to send this header differently, add it manually with the format you want to use.– Jéf Bueno
Can you give me an example of how to do this ?
– Pedro Azevedo
Of course. Your question of this question has been answered, right? Open a new question with the other specific question.
– Jéf Bueno