DateTimeOffSet values are often converted to strings for display or some other purpose. But these representations often fail when they are used to convert them back to valid date/time values.
We need to use the ToString method’s overload and pass the “u” or “s” formats as they are culture-invariant.
For example:
DateTimeOffSet d = DateTimeOffSet.Now;Console.WriteLine(d.ToString("u"));