开发者

Is there a constant describing the minimal Windows FileTime Value in .Net?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜