Skip to content

TryParseExact of DateTimeOffset.MinValue fails #60064

Answered by Clockwork-Muse
alexdrl asked this question in Q&A
Discussion options

You must be logged in to vote
// Outputs 01/01/0001 00:00:00 +00:00
Console.WriteLine(DateTimeOffset.MinValue.ToString());

The string you're working with isn't on the list of acceptable formats. You either need to add the invariant culture formats to the list of acceptable formats, or explicitly format the source string to one you expect.

(separately, I'm annoyed the InvariantCulture doesn't use an ISO format, but that would be a massive breaking change....)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alexdrl
Comment options

@Clockwork-Muse
Comment options

Answer selected by alexdrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants