I have a C# DateTime object. This object includes both the date and time. I need to pass this information to a REST-based service. My question is, how do I format the DateTime,
string s = DateTime.ToString("yyyyMMddHHmmssfff") Note: fff is milliseconds (you may remove the 'fff' if it is not needed) Then convert it back to DateTime using DateTime d = DateTime.ParseExact(s, "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture)
DateTime
CultureInfo