Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to check if it is the current time day.js

var now = new Date(),
    day = now.getDay(),
    hours = now.getHours();

//Check if day is Mon-Fri
if(0 < day < 6) {
  //check between 9am and 5pm
  if(9 <= hours <= 17) {
     if(hours !== 17 || now.getMinutes() <= 30) {
          //your jQuery code here
     }
  }
}
Comment

how to check if it is the current time day.js

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);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: difference between single quotes and double quotes in javascript 
Javascript :: button click 
Javascript :: how i get selected class of li in jquery 
Javascript :: multiple checkbox validation in javascript 
Javascript :: write !important in react 
Javascript :: js spread parameters 
Javascript :: javascript icon 
Javascript :: detect system dark mode tailwind css 
Javascript :: nodejs temp file 
Javascript :: Anonymous Functions with arguments in JavaScript 
Javascript :: iterating over a string 
Javascript :: how to use the foreach fnction javascript loop through array 
Javascript :: what is event loop in javascript 
Javascript :: javascript table functions 
Javascript :: run javascript in atom 
Javascript :: linked list algorithm javascript 
Javascript :: open bootstrap modal using vanilla js 
Javascript :: react native setTimeOut error 
Javascript :: crud in node 
Javascript :: create your own programming language in javascript 
Javascript :: scroll to div bottom 
Javascript :: react native panresponder on click 
Javascript :: For-each over an array in JavaScript 
Javascript :: pure function 
Javascript :: readline nodejs 
Javascript :: javascript date objects 
Javascript :: mongoose save return id 
Javascript :: backbone js 
Javascript :: javascript set query parameters in url 
Javascript :: Javascript async await & Promise 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =