Ver Mensaje Individual
  #21 (permalink)  
Antiguo 10/01/2016, 12:53
dip0813000254
 
Fecha de Ingreso: enero-2016
Ubicación: neuquen
Mensajes: 19
Antigüedad: 8 años, 4 meses
Puntos: 0
Mensaje Respuesta: agregar variable a funcion de horarios

Cita:
Iniciado por IsaBelM Ver Mensaje
Intentaré interpretarte. Te refieres a esto??
mira yo tenia el siguiente codigo

Código Javascript:
Ver original
  1. <script language="javascript">
  2. function mensajes(){
  3.    var txthello="";
  4.    var now = new Date();
  5.    var day = now.getDay();
  6.    var hours = now.getHours();
  7.  
  8.    //domingo
  9.     if(day == 0){
  10.         if ((hours>=0) && (hours< 6)) {txthello="domingo madrugada";}
  11.         else if ((hours>=6) && (hours< 20)) {txthello="domingo tarde";}
  12.         else if ((hours>=20) && (hours< 24)) {txthello="domingo noche";}
  13.     }
  14.  
  15.     //martes
  16.     else if(day == 2){
  17.         if ((hours>=0) && (hours<6)) {txthello=" MARTES MADRUGADA";}
  18.         else if ((hours>=6) && (hours< 21)) {txthello=" MARTES DIA";}
  19.         else if ((hours>=21) && (hours< 24)) {txthello=" MARTES NOCHE";}
  20.     }
  21.    
  22.          
  23.    document.write(txthello + '<br/>');
  24. }
  25. mensajes();
  26.    
  27. </script>

a este codigo yo queria agregarle los minutos, logre hacerlo pero con los errores que escribi mas arriba que solo entre ciertos minutos funciona el texto, utilice el codigo que me facilitaste para convertir las horas y minutos a cifras pero no consigo que funciones, habra alguna manera de realizar lo que intento hacer con el codigo este que mostre??