📜  如何检查是否是当前时间 day.js - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:06.694000             🧑  作者: Mango

代码示例2
document.getElementById('tmp_button-48523').addEventListener('click', function() {
let d = new Date();
let localTime = d.getTime();
let localOffset = d.getTimezoneOffset() * 60000;
let utc = localTime + localOffset;
let target_offset = -7;//PST from UTC 7 hours behind right now, will need to fix for daylight
let los_angles = utc+(3600000*target_offset);
nd = new Date(los_angles);
let current_day = nd.getDay();
let hours = nd.getHours();
let mins = nd.getMinutes();

alert("los_angles time is " + nd.toLocaleString());
alert("Day is "+current_day);

if(current_day==2 && hours >= 14 && hours <=15  )
if(hours!=15 && mins >= 32)
fbq('track', 'LT-Login');

}, false);

function fbq(p1,p2){
alert(p1);
}