C#| DateTime.ToFileTimeUtc()方法与示例
DateTime.ToFileTimeUtc()方法
DateTime.ToFileTimeUtc()方法用于将当前的DateTime对象转换为Windows文件时间。
语法:
long DateTime.ToFileTimeUtc();
Parameter(s):
它不接受任何参数。
返回值:
此方法的返回类型很长–它返回一个长整数值,该值代表Windows文件时间。
举例说明方法的例子DateTime.ToFileTimeUtc()
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//创建DateTime类的对象
//然后用当前时间进行初始化
//使用“现在”"Now"
DateTime dt = DateTime.Now;
//从当前日期时间转换为Windows文件时间
long time = dt.ToFileTimeUtc();
//printing the current date & time
Console.WriteLine("The current time is: " + dt.ToString());
//Windows文件时间中的打印时间
Console.WriteLine("Windows file time: " + time);
//只是打印新行
Console.WriteLine();
}
}
}输出结果
RUN 1: The current time is: 10/17/2019 1:17:21 PM Windows file time: 132157918412997330 RUN 2: The current time is: 10/17/2019 1:17:45 PM Windows file time: 132157918652078310
如果我们多次运行程序,输出将不同。
热门推荐
1 如何训练狗狗不叫
2 训练狗狗不叫
3 训练狗狗随行
4 怎么训练狗狗不叫
7 训练比熊狗狗教程
10 上海狗狗训练
11 怎么训练狗狗上厕所
12 训练狗狗趴下
13 狗狗服从训练
14 训练狗狗拒食
15 训练狗狗笑
16 训练狗狗大便
17 训练狗狗立
18 训练狗狗捡东西