This solution makes use of the DateTimeStyles enumeration, and it also works with Z.
DateTime d2 = DateTime.Parse("2010-08-20T15:00:00Z", null, System.Globalization.DateTimeStyles.RoundtripKind);
This prints the solution perfectly.
More Related Contents:
- How to parse and generate DateTime objects in ISO 8601 format
- How do I calculate someone’s age based on a DateTime type birthday?
- Parse string to DateTime in C#
- Parse DateTime with time zone of form PST/CEST/UTC/etc
- Creating a DateTime in a specific Time Zone in c#
- How to truncate milliseconds off of a .NET DateTime
- C# DateTime.Now precision
- format date in c#
- How do I get the last day of a month?
- What does “DateTime?” mean in C#?
- Measuring code execution time
- How to compare DateTime in C#?
- Environment.TickCount vs DateTime.Now
- Why DateTime.AddHours doesn’t seem to work?
- How to convert Javascript datetime to C# datetime?
- How to find the 3rd Friday in a month with C#?
- How does DateTime.ToUniversalTime() work?
- DateTime ToString issue with formatting months with “mm” specifier
- why does DateTime.ToString(“dd/MM/yyyy”) give me dd-MM-yyyy?
- How to ensure a timestamp is always unique?
- How can I format DateTime to web UTC format?
- datetime to string with time zone
- How frequent is DateTime.Now updated ? or is there a more precise API to get the current time?
- Convert String to Date in .NET if my incoming date format is in YYYYMMDD
- Getting the first and last day of a month, using a given DateTime object
- Days, hours, minutes, seconds between two dates
- Convert Date from Persian to Gregorian
- Unix time conversions in C# [duplicate]
- .NET: Why is TryParseExact failing on Hmm and Hmmss?
- LINQ Query to Convert string to datetime