I need to send DateTime object as string
So that I'll be able to parse this string back to DateTime and not lose data.
i.e. restore the original object.
Which format should I use?
I need to send DateTime object as string
So that I'll be able to parse this string back to DateTime and not lose data.
i.e. restore the original object.
Which format should I use?
Use the round-trip format "O":
string s = dateTime.ToString("O");
DateTime d =
DateTime.ParseExact(s, "O", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);