How to convert JavaScript date object to ticks

后端 未结 6 1788
[愿得一人]
[愿得一人] 2020-11-28 04:54

How should I convert JavaScript date object to ticks? I want to use the ticks to get the exact date for my C# application after synchronization of data.

6条回答
  •  长情又很酷
    2020-11-28 05:06

    If by "ticks" you mean something like "milliseconds since the epoch", you can call ".getTime()".

    var ticks = someDate.getTime();
    

    From the MDN documentation, the returned value is an

    Integer value representing the number of milliseconds since 1 January 1970 00:00:00 UTC (Unix Epoch).

提交回复
热议问题