简体   繁体   中英

Convert Javascript Date object to Filetime

Can't believe I'm unable to find the very simple case of converting a Javascript date object to Filetime.
The other way around popped up a lot while searching.

I have provided the solution below for anyone else who is looking for it.

To convert now to Filetime:

 function filetimeFromDate(date) { return date.getTime() * 1e4 + 116444736e9; } const now = new Date(); const filetimeNow = filetimeFromDate(now); console.log(filetimeNow);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM