C# Datetime转Utc时间戳Timestamp
C# Datetime转Utc时间戳Timestamp
C# Code:
/// <summary>
/// 返回时间戳,秒
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static long getUtcTrick(DateTime time)
{
DateTimeOffset fs = new DateTimeOffset(time);
long trick = (fs.UtcTicks - 621355968000000000) / 10000000;//秒值
return trick;
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
/// <summary>
/// 返回时间戳,秒
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static long getUtcTrick(DateTime time)
{
DateTimeOffset fs = new DateTimeOffset(time);
long trick = (fs.UtcTicks - 621355968000000000) / 10000000;//秒值
return trick;
}
//来源:C/S框架网(www.csframework.com) QQ:23404761
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网