Como agregarle minutos a este codigo?

Hola, encontre un codigo que me sirve para la programacion de una radio para que muestre en la web "en el aire: programa tal" por ejemplo, pero hay algunos programas que son en distintos horarios que se distinguen por minutos como por ejemplo de 17:30, intente agregar los minutos con codigos que busque en la web pero no funciona, para que tengas unas idea mejor de lo que te hablo te pasteo el codigo y veras que solo muestra la informacion por dia y hora, me faltaria minutos
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>En el aire</title>
<style type="text/css">
td { font-size:0.6em; } /* temporary for testing purposes */
#NowOn {
border: 2px solid red;
font-size: 1.0em;
color: red;
background: yellow;
height: 100px;
width: 280px;
}
</style>
<script type="text/javascript">
/* NOT CURRENTLY USED
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
var GMT = new Date().getTimezoneOffset();
var offsetGMT = -5 * new Date().getTimezoneOffset()/60;
*/
// Sun=0 1 2 3 4 5 Sat=6
var DayOfWeek = new Array('Weekend','Monday','Tuesday','Wednesday','Thursday','Friday','Weekend');
var NoShow = 'No Show Scheduled<br />for KSWH';
var DH = new Array (7);
for (d=0; d<7; d++) {
DH[d] = new Array (24);
for (h=0; h<24; h++) { DH[d][h] = ''; }
}
DH[5][17] = 'Acierte con Datelli<br>Con Daniel Biodre<br>';
DH[1][12] = 'No Show Name<br>with DJ JT<br>Monday at Noon<br>No Genre';
DH[1][14] = 'Real Talk<br>with DJ Yella<br>Monday at 2 PM<br>No Genre';
DH[1][16] = 'No Show Name<br>with Katy Cox<br>Monday at 4 PM<br>Rap';
DH[1][17] = 'The Greatest<br>with DJ Fresh<br>Monday at 5 PM<br>No Genre';
DH[1][18] = 'Revolution Corner<br>with Randy Underwood<br>Monday at 6 PM<br>No Genre';
DH[1][20] = 'Daily Affirmation<br>with DJ Hightower<br>Monday at 8 PM<br>No Genre';
DH[1][22] = 'No Show Name<br>with David Doggett<br>Monday 10 to Midnight<br>No Genre';
DH[1][23] = 'No Show Name<br>with David Doggett<br>Monday at 11 PM<br>No Genre';
DH[2][13] = 'No Show Name<br>with Michelle Caillouet<br>Tuesday at 1 PM<br>Rock';
DH[2][16] = 'No Show Name<br>with Sweet Action Jackson<br>Tuesday at 4 PM<br>Rock';
DH[2][20] = 'The Rock Hour<br>with Dan the Man<br>Tuesday at 8 PM<br>No Genre';
DH[3][10] = 'Love Me! Hate Me!<br>with DJ Nia<br>Wednesday at 10 AM<br>No Genre';
DH[3][11] = 'Westcoast Wednesdays<br>with DJ Smoove<br>Wednesday at 11 AM<br>No Genre';
DH[3][15] = 'The Storm Hour<br>with the Weatherman and Reba<br>Wednesday 3 to 5 PM<br>Classic Rock';
DH[3][16] = 'The Storm Hour<br>with the Weatherman and Reba<br>Wednesday at 4 PM<br>Classic Rock';
DH[3][22] = 'EZ Does It<br>with DJ EZ<br>Wednesday at 10 PM<br>Rap';
DH[4][12] = 'The Quad Show<br>with J Bean & LongJohn<br>Thursday Noon to 2 PM<br>Rap/Urban';
DH[4][13] = 'The Quad Show<br>with J Bean & LongJohn<br>Thursday at 1 PM<br>Rap/Urban';
DH[4][14] = 'The Hour<br>with DJ V-Jeezy<br>Thursday at 2 PM<br>No Genre';
DH[4][15] = 'No Show Name<br>with DJ Savana<br>Thursday at 3 PM<br>No Genre';
DH[5][10] = 'The Christian Hour<br>with Jammin J<br>Friday 10 to Noon<br>Christian';
DH[5][11] = 'The Christian Hour<br>with Jammin J<br>Friday at 11 AM<br>Christian';
DH[5][12] = 'The Em and Tag Show<br>with Em and Tag<br>Friday Noon to 2 PM<br>Rock';
DH[5][13] = 'The Em and Tag Show<br>with Em and Tag<br>Friday at 1 PM<br>Rock';
DH[5][14] = 'No Show Name<br>with DJ Kevin<br>Friday at 3 PM<br>No Genre';
DH[5][15] = 'Big Hamptons Block<br>with Big Hampton<br>Friday 4 to 6 PM<br>Rap';
DH[5][16] = 'Big Hamptons Block<br>with Big Hampton<br>Friday at 5 PM<br>Rap';
DH[5][22] = 'Rockin till Midnight<br>with DJ Werewolf<br>Friday 10 to Midnight<br>Rock';
DH[5][23] = 'Rockin till Midnight<br>with DJ Werewolf<br>Friday at 11 PM<br>Rock';
// Add more when schedule is known. Note: there may be better ways to do this when information is known.
function OnNow() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
// alert(dayofweek+':'+hourofday+'<br />'+DH[dayofweek][hourofday]);
var showOn = DH[dayofweek][hourofday];
if (showOn == '') { showOn = thedate+'\n\nNo Show Currently Scheduled for KSWH'; }
alert(showOn);
}
function NowON() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
var showOn = DH[dayofweek][hourofday];
if (showOn == '') { showOn = thedate+'<p />No Show Currently Scheduled for KSWH'; }
document.getElementById('NowOn').innerHTML = showOn;
}
</script>
</head>
<BODY onLoad="NowON()">
<!-- Unhide this if table display desired
<script type="text/javascript">
document.write(TableStationSchedule())
</script>
-->
<script type="text/javascript">
document.write(NowON());
</script>
<div id='NowOn' onClick="NowON()">Click For Now On KSWH</div>
</body>
</html>
{"lat":-34.524767543284,"lng":-58.5199642181396}

1 Respuesta

Respuesta
1
para obtener los minutos, tiene que llamar a la funcion getMinutes(), abajo de
var hourofday = thedate.getHours();
 Agregas:
var minutes = thedate.getMinutes();
Despues, tendras que agregar un 3 array encestado, con los valores 0 para los programas que empieza en punto, y 1 para los que empiezan y media.
Despues simplemente evaluas el valor de minutes, y si es mayor que 30,, llamas al programa de y media (observa que deberas hacerlo qun cuando el programa sea el mismo).
uhmm la verdad no tengo mucha idea sobre codigos pero de acuerdo a lo que me dijiste y averiguando mas por ahi hice esto pero me sigue sin andar. lo habré hecho bien??? 
espero que me vuelvas a dar una mano. gracias!!!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>En el aire</title>
<style type="text/css">
td { font-size:0.6em; } /* temporary for testing purposes */
#NowOn {
border: 2px solid red;
font-size: 1.0em;
color: red;
background: yellow;
height: 100px;
width: 280px;
}
</style>
<script type="text/javascript">
/* NOT CURRENTLY USED
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
var minutes = thedate.getMinutes();
var GMT = new Date().getTimezoneOffset();
var offsetGMT = -5 * new Date().getTimezoneOffset()/60;
*/
// Sun=0 1 2 3 4 5 Sat=6
var DayOfWeek = new Array('Weekend','Monday','Tuesday','Wednesday','Thursday','Friday','Weekend');
var NoShow = 'No Show Scheduled<br />for KSWH';
var DH = new Array (7);
for (d=0; d<7; d++) {
DH[d] = new Array (24);
for (h=0; h<24; h++) {
var DH = new Array (0);
for (i=0; i<1; i++) {
DH[d][h]
= ''; }
}
DH[5][17][1] = 'Acierte con Datelli<br>17:30 hs<br>';

DH[1][12] = 'No Show Name<br>with DJ JT<br>Monday at Noon<br>No Genre';
DH[1][14] = 'Real Talk<br>with DJ Yella<br>Monday at 2 PM<br>No Genre';
DH[1][16] = 'No Show Name<br>with Katy Cox<br>Monday at 4 PM<br>Rap';
DH[1][17] = 'The Greatest<br>with DJ Fresh<br>Monday at 5 PM<br>No Genre';
DH[1][18] = 'Revolution Corner<br>with Randy Underwood<br>Monday at 6 PM<br>No Genre';
DH[1][20] = 'Daily Affirmation<br>with DJ Hightower<br>Monday at 8 PM<br>No Genre';
DH[1][22] = 'No Show Name<br>with David Doggett<br>Monday 10 to Midnight<br>No Genre';
DH[1][23] = 'No Show Name<br>with David Doggett<br>Monday at 11 PM<br>No Genre';
DH[2][13] = 'No Show Name<br>with Michelle Caillouet<br>Tuesday at 1 PM<br>Rock';
DH[2][16] = 'No Show Name<br>with Sweet Action Jackson<br>Tuesday at 4 PM<br>Rock';
DH[2][20] = 'The Rock Hour<br>with Dan the Man<br>Tuesday at 8 PM<br>No Genre';
DH[3][10] = 'Love Me! Hate Me!<br>with DJ Nia<br>Wednesday at 10 AM<br>No Genre';
DH[3][11] = 'Westcoast Wednesdays<br>with DJ Smoove<br>Wednesday at 11 AM<br>No Genre';
DH[3][15] = 'The Storm Hour<br>with the Weatherman and Reba<br>Wednesday 3 to 5 PM<br>Classic Rock';
DH[3][16] = 'The Storm Hour<br>with the Weatherman and Reba<br>Wednesday at 4 PM<br>Classic Rock';
DH[3][22] = 'EZ Does It<br>with DJ EZ<br>Wednesday at 10 PM<br>Rap';
DH[4][12] = 'The Quad Show<br>with J Bean & LongJohn<br>Thursday Noon to 2 PM<br>Rap/Urban';
DH[4][13] = 'The Quad Show<br>with J Bean & LongJohn<br>Thursday at 1 PM<br>Rap/Urban';
DH[4][14] = 'The Hour<br>with DJ V-Jeezy<br>Thursday at 2 PM<br>No Genre';
DH[4][15] = 'No Show Name<br>with DJ Savana<br>Thursday at 3 PM<br>No Genre';
DH[5][10] = 'The Christian Hour<br>with Jammin J<br>Friday 10 to Noon<br>Christian';
DH[5][11] = 'The Christian Hour<br>with Jammin J<br>Friday at 11 AM<br>Christian';
DH[5][12] = 'The Em and Tag Show<br>with Em and Tag<br>Friday Noon to 2 PM<br>Rock';
DH[5][13] = 'The Em and Tag Show<br>with Em and Tag<br>Friday at 1 PM<br>Rock';
DH[5][14] = 'No Show Name<br>with DJ Kevin<br>Friday at 3 PM<br>No Genre';
DH[5][15] = 'Big Hamptons Block<br>with Big Hampton<br>Friday 4 to 6 PM<br>Rap';
DH[5][16] = 'Big Hamptons Block<br>with Big Hampton<br>Friday at 5 PM<br>Rap';
DH[5][22] = 'Rockin till Midnight<br>with DJ Werewolf<br>Friday 10 to Midnight<br>Rock';
DH[5][23] = 'Rockin till Midnight<br>with DJ Werewolf<br>Friday at 11 PM<br>Rock';
// Add more when schedule is known. Note: there may be better ways to do this when information is known.
function OnNow() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
// alert(dayofweek+':'+hourofday+'<br />'+DH[dayofweek][hourofday]);
var showOn = DH[dayofweek][hourofday];
if (showOn == '') { showOn = thedate+'\n\nNo Show Currently Scheduled for KSWH'; }
alert(showOn);
}
function NowON() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
var showOn = DH[dayofweek][hourofday];
if (showOn == '') { showOn = thedate+'<p />No Show Currently Scheduled for KSWH'; }
document.getElementById('NowOn').innerHTML = showOn;
}
</script>
</head>
<BODY onLoad="NowON()">
<!-- Unhide this if table display desired
<script type="text/javascript">
document.write(TableStationSchedule())
</script>
-->
<script type="text/javascript">
document.write(NowON());
</script>
<div id='NowOn' onClick="NowON()">Click For Now On KSWH</div>
</body>
</html>
El código deberia ser algo parecido a esto:
<script type="text/javascript">
// Sun=0 1 2 3 4 5 Sat=6
var DayOfWeek = new Array('Weekend','Monday','Tuesday','Wednesday','Thursday','Friday','Weekend');
var NoShow = 'No Show Scheduled<br />for KSWH';
var DH = new Array (7);
for (d=0; d<7; d++) {
DH[d] = new Array (24);
for (h=0; h<24; h++) {
var DH = new Array (0);
for (i=0; i<1; i++) {
DH[d][h] = ''; }
}
DH[1][12][0] = 'No Show Name<br>with DJ JT<br>Lunes a las 12.00<br>No Genre';
DH[1][12][1] = 'No Show Name<br>with DJ JT<br>Lunes a las 12.30<br>No Genre';
DH[1][14][0] = 'Real Talk<br>with DJ Yella<br>Lunes a las 14.00<br>No Genre';
DH[1][14][1] = 'Talk Real<br>with DJ Guest<br>Lunes a las 14.30<br>No Genre';
DH[1][16][0] = 'No Show Name<br>with Katy Cox<br>Lunes a las 16.00<br>Rap';
DH[1][16][1] = 'No Show Name<br>with Katy Cox<br>Lunes a las 16.30<br>Rap';
DH[1][17][0] = 'The Greatest<br>with DJ Fresh<br>Lunes a las 17.30<br>No Genre';
DH[1][17][1] = 'Acierte con Datelli<br>17:30 hs<br>';
// Add more when schedule is known. Note: there may be better ways to do this when information is known.
function OnNow() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
var minutes = thedate.getMinutes();
if(minutes < 30){ var show = 0;}else{ var show = 1;}
// alert(dayofweek+':'+hourofday+'<br />'+DH[dayofweek][hourofday]);
var showOn = DH[dayofweek][hourofday][show];
if (showOn == '') { showOn = thedate+'\n\nNo Show Currently Scheduled for KSWH'; }
alert(showOn);
}
function NowON() {
var thedate = new Date();
var dayofweek = thedate.getDay();
var hourofday = thedate.getHours();
var minutes = thedate.getMinutes();
if(minutes < 30){ var show = 0;}else{ var show = 1;}
var showOn = DH[dayofweek][hourofday][show];
if (showOn == '') { showOn = thedate+'<p />No Show Currently Scheduled for KSWH'; }
document.getElementById('NowOn').innerHTML = showOn;
}
</script>
</head>
<BODY onLoad="NowON()">
<!-- Unhide this if table display desired
<script type="text/javascript">
document.write(TableStationSchedule())
</script>
-->
<script type="text/javascript">
document.write(NowON());
</script>
Por una cuestion de tiempo, sólo puse 4 horarios, fijate que dupliqué los que duran 1 hora, de otro modo te diría que no hay programa a esa hora.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas