I am using the DateTime.ToFileTime and Fro开发者_运维技巧mFileTime methods to store and retrieve timestamps in a database. The mininum windows file time is midnight, Jan 1, 1601. Is there a constant similar to DateTime.MinValue, that describes this value?
No, but it is simple to create your own:
public static readonly DateTime MinFileTime = DateTime.FromFileTimeUtc(0);
For people like me searching for the same "min file value" for a DateTimeOffset
, the definition would be:
public static readonly DateTimeOffset MinFileTimeOffset = new DateTimeOffset(MinFileTime);
with MinFileTime defined as in Hans' answer..
PS: DateTimeOffset doesn't have a FromFileTimeUtc
method.
精彩评论