将.net代码转换为javascript unix时间戳

时间:2017-07-01 02:21:15

标签: javascript c# .net postman

我想知道这个.NET代码相当于javascript和prequest脚本postman:

private  string GetRequestTimeStamp()
{
    DateTime epochStart = new DateTime(1970, 01, 01, 0, 0, 0, 0, 
    DateTimeKind.Utc);
    TimeSpan timeSpan = DateTime.UtcNow - epochStart;
    string requestTimeStamp = Convert.ToUInt64(timeSpan.TotalSeconds).ToString();
    return requestTimeStamp;
}

我尝试了这个,但它不一致

function epochTime()
{
    var d = new Date();
    var t = d.getTime();
    var o = t + "";
    return o.substring(0, 10);
 }

0 个答案:

没有答案