/// <summary>
/// 将DateTime时间格式转换为Unix时间戳格式
/// </summary>
/// <param name="dateTime">DateTime时间</param>
/// <param name="format">精度:Seconds-秒,Milliseconds-毫秒</param>
/// <returns></returns>
public static long ToUnixTimeStamp(this DateTime dateTime, string accuracy)
{
long intResult = ;
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(, , ));
switch (accuracy)
{
case "Seconds":
intResult = (long)(dateTime - startTime).TotalSeconds;
break;
case "Milliseconds":
intResult = (long)(dateTime - startTime).TotalMilliseconds;
break;
default:
intResult = (long)(dateTime - startTime).TotalSeconds;
break;
} return intResult;
}