A number everyday of the month "and" a different number depending on the day of the month´s day time

xra

Joined
Mar 16, 2021
Messages
2
Reaction score
0
I got this code which works correctly and i want to implement into the array code below

var temadiario = 500
var horaActual = new Date().getHours();
if(horaActual >= 0 && horaActual <= 16){
document.write(temadiario+=100)
} else if(horaActual >= 17 && horaActual <= 23){
document.write(temadiario+=300)
}


what the array does is to get the number from the day of the month
what i want now is then plus 100 or 300 as above to show a different number depending on the time of the day


var temadiario=new Date().getDate()
var a=new Array()

a[1]='<b> &nbsp; 4557</b>'
a[2]='<b> &nbsp; 4905</b>'
a[3]='<b> &nbsp; 5308</b>'
a[4]='<b> &nbsp; 5742</b>'
a[5]='<b> &nbsp; 6263</b>'
a[6]='<b> &nbsp; 6631</b>'
a[7]='<b> &nbsp; 7088</b>'
a[8]='<b> &nbsp; 7517</b>'
a[9]='<b> &nbsp; 7993</b>'
a[10]='<b> &nbsp; 8321</b>'
a[11]='<b> &nbsp; 8872</b>'
a[12]='<b> &nbsp; 9246</b>'
a[13]='<b> &nbsp; 9619</b>'
a[14]='<b> &nbsp; 10189</b>'
a[15]='<b> &nbsp; 10683</b>'
a[16]='<b> &nbsp; 11065</b>'
a[17]='<b> &nbsp; 11341</b>'
a[18]='<b> &nbsp; 11582</b>'
a[19]='<b> &nbsp; 11842</b>'
a[20]='<b> &nbsp; 1237</b>'
a[21]='<b> &nbsp; 12677</b>'
a[22]='<b> &nbsp; 13148</b>'
a[23]='<b> &nbsp; 246</b>'
a[24]='<b> &nbsp; 795</b>'
a[25]='<b> &nbsp; 1219</b>'
a[26]='<b> &nbsp; 1745</b>'
a[27]='<b> &nbsp; 2292</b>'
a[28]='<b> &nbsp; 2630</b>'
a[29]='<b> &nbsp; 3014</b>'
a[30]='<b> &nbsp; 3500</b>'
a[31]='<b> &nbsp; 3946</b>'

document.write(a[temadiario])
 
Joined
Nov 27, 2019
Messages
163
Reaction score
28
I don't see where you get the time of day. I don't see how you combined the two sections of code. Show me what you have tried.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top