netnr / ToTimestamp.cs
2018-11-03 10:13

将Datetime转换成时间戳,10位,秒

  ToTimestamp.cs csharp Raw
/// <summary>
/// 将Datetime转换成时间戳,10位,秒
/// </summary>
/// <param name="datetime"></param>
/// <returns></returns>
public static long ToTimestamp(this DateTime datetime)
{
    return (datetime.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
}
ˆ