Why Azure Table Storage has a different DateTime.MinValue limit than .NET

azure, azure-storage, azure-table-storage

Solution

Most likely Azure stores these values in a different format than that used by `DateTime`. It is rather common for the type systems of database engines to differ from that of any client programming language. Engineering is frequently about tradeoffs, and database developers often make different choices than other tool developers do. For example, `DateTime` uses two bits to store timezone-related data in order to support roundtripping between UTC and local time during daylight savings transitions. These extra two bits are masked away when performing comparisons, hashing, or serialization. I highly doubt that Azure stores such info as it has no need for it and it would only serve to unnecessarily complicate querying.

Unfortunately I don't know of any reference on the specifics of how `DateTime` is stored in Azure, but this MSDN blog mentions both the limited range of `DateTime` as well as another way in which Azure types are more limited than the .NET equivalents - `String` and `byte[]` are limited to 64KB.

Problem

.NET `DateTime.MinValue` is 1/1/0001, however Windows Azure Table Storage does not accept this value, because it has a different lower limit: `CloudTableClient.MinSupportedDateTime`. Why there is such a difference, what made Azure team to design it that way? It is something just problematic and I believe there is a technical difficulty behind this choice.

Original source