Reputation: 197
I have a string in the following format
19/11/2012 15:40:15
I would like to convert this to UTC format but still keep it as a string. e.g:
2012-11-19T15:40:15.000000+00:00
Upvotes: 1
Views: 76
Reputation: 29683
You can use DateTimeOffset.Parse
and convert it to UTC
and then back to String
as below:
string date= "19/11/2012 15:40:15";
string newUTCdate=Convert.ToString(DateTimeOffset.Parse(date).UtcDateTime);
Upvotes: 4