獲取00:00:00時(shí)間戳和23:59:59的時(shí)間戳
?const?start?=?new?Date(new?Date().toLocaleDateString()).getTime();
?console.log(start);
const?end?=?new?Date(new?Date().toLocaleDateString()).getTime()?+?24?*?60?*?60?*?1000?-?1;
console.log(end);?
// 將時(shí)間戳轉(zhuǎn)換成日期格式? ?
new Date() ; ? ? ?
//?將日期轉(zhuǎn)換成時(shí)間戳
getTime();
打印應(yīng)為:
//Mon Dec 04 2017 00:00:00 GMT+0800 (中國(guó)標(biāo)準(zhǔn)時(shí)間)
//Mon Dec 04 2017 23:59:59 GMT+0800 (中國(guó)標(biāo)準(zhǔn)時(shí)間)