d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Clock Script
Add Reply New Topic New Poll
Member
Posts: 3,530
Joined: Jun 19 2014
Gold: 66.81
Apr 2 2016 06:33am
Looking for a javascript clock script that will display different words in certain colours under the time depending on the time and also change the colour of the time. Should be a 24 hour clock with a analoge display and will be based on malaysia timezone (gmt+8). Full details will be supplied.

Is this something thats possible? Offering fg. Dont worry i can get more easily.

Thanks
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Apr 2 2016 10:58pm
You can use the Date() object to find your time, afterwards you just have to parse a range of times and use logical ifs to print your colors and words.

Code
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();

if(hours > 0 && hours < 2) {
//if the hours are between 0:00 and 2:00 print this
document.write('<font color="red">It's way to late for this shit.</font> ')
}

document.write(hours + ':' + minutes);


Or some shit like that.

As for analog displays, you're on your own. I'd imagine someone has written something on github for that task already. Google is your friend.

This post was edited by AbDuCt on Apr 2 2016 11:01pm
Member
Posts: 769
Joined: Apr 1 2016
Gold: 0.00
Apr 5 2016 02:43pm
I can help but you need to tell me what it's for.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll