在C#中将当前DateTime对象的值转换为Windows文件时间
要将当前DateTime对象的值转换为Windows文件时间,代码如下-
示例
using System;
public class Demo {
public static void Main() {
DateTime d = DateTime.Now;
Console.WriteLine("Date = {0}", d);
long res = d.ToFileTime();
Console.WriteLine("Windows file time = {0}", res);
}
}输出结果
这将产生以下输出-
Date = 10/16/2019 8:17:26 AM Windows file time = 132156874462559390
示例
让我们看另一个例子-
using System;
public class Demo {
public static void Main() {
DateTime d = new DateTime(2019, 05, 10, 6, 10, 25);
Console.WriteLine("Date = {0}", d);
long res = d.ToFileTime();
Console.WriteLine("Windows file time = {0}", res);
}
}输出结果
这将产生以下输出-
Date = 5/10/2019 6:10:25 AM Windows file time = 132019422250000000
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短