What is the best and fastest way to convert a DateTime to this format?
2015-03-26T18:02:58.145798Z
Currently I receive a date from a server and I'm able to parse it and convert the date in to DateTime and the ToString() output is something like this:
26/03/2015 18:02:58
For converting the date I'm using this line of code:
var parsedDate = DateTime.Parse("2015-03-26T18:02:58.145798Z", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
What is the best way to convert parsedDate back to the original format?
EDIT: I want to convert the DateTime to this format 2015-03-26T18:02:58.145798Z as string