Code Pad
Code
List Code
Search Code
Images
List Images
Search Images
Login
Privacy
Home
date time testing
jquery ui datepicker
js
styling css elements based on their attributes
css
animate background gradient css
css
linear gradient background with 3 colours
css
web storage testing
js
load a script based on a page condition variable
jquery
loop through elements and change the content using each and substr with jquery
jquery
mega menu testing
css
basic foundation grid layout
html
date time testing
3:09 am, February 22, 2019
hide and show a div based on time zone, day, hour and minute.
Code
html
css
js
scripts
html
..
css
js
$(document).ready(function(){ var d = new Date(), hours = d.getHours(), mins = d.getMinutes(), day = d.getDay(), time_zone_offset = d.getTimezoneOffset(); var CurrentDay = d.getDay(); var OpeningTime = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 8, 30); var ClosingTime = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 17, 30); var Open = (d.getTime() > OpeningTime.getTime() && d.getTime() < ClosingTime.getTime()); var bugs = ""; bugs = bugs + "hours:" + hours + ", \n"; bugs = bugs + "mins :" + mins + ", \n"; bugs = bugs + "day :" + day + ", \n"; bugs = bugs + "time_zone_offset :" + time_zone_offset + ", \n"; bugs = bugs + "OpeningTime: " + OpeningTime + ", \n"; bugs = bugs + "ClosingTime: " + ClosingTime+ ", \n"; bugs = bugs + "Open : " + Open + ", \n"; console.log(bugs); if (CurrentDay !== 6 && CurrentDay !== 0 && Open) { $('.chatbox').html('open'); } else { $('.chatbox').html('closed'); } });
scripts
Download & Run
Download File
Run Demo
Re-load Preview
Preview
9JOSe