Ver Mensaje Individual
  #5 (permalink)  
Antiguo 08/10/2007, 09:40
Avatar de mdavila
mdavila
 
Fecha de Ingreso: julio-2007
Ubicación: Montevideo (Uruguay)
Mensajes: 919
Antigüedad: 16 años, 8 meses
Puntos: 13
Re: Reloj contador....

Les muestro lo que tengo y el problema esta que las horas me da papa fritas jejeje



F_final = new Date();

F_final.setYear(2007);
F_final.setDate(8);
F_final.setMonth(9);
F_final.setHours(15);
F_final.setMinutes(0);
F_final.setSeconds(0);
F_final.setMilliseconds(0);

objeto_fecha = new Date();
horas = "";
horas = objeto_fecha.getHours();
horas = horas + 2;



if (horas < 10)
{
horas = "0" + horas;
} // end if
minutos = objeto_fecha.getMinutes();
minutos_digito = "";
if (minutos < 10)
{
minutos_digito = "0";
} // end if
minutos_digito = minutos_digito + objeto_fecha.getMinutes();
segundos = objeto_fecha.getSeconds();
segundos_digito = "";
if (segundos < 10)
{
segundos_digito = "0";
} // end if
segundos_digito = segundos_digito + objeto_fecha.getSeconds();
Fecha = new Date();
F_actual = Fecha.getTime();
F_final = Math.floor(F_final / 86400000);
F_actual = Math.floor(F_actual / 86400000);
D_faltan = F_final - F_actual;
objetivo_segundos = 60 - segundos_digito;
if (objetivo_segundos < 10)
{
objetivo_segundos = "0" + objetivo_segundos;
} // end if
if (objetivo_segundos == "60")
{
objetivo_segundos = "00";
--minutos_digito;
} // end if
objetivo_minutos = 59 - minutos_digito;
if (objetivo_minutos < 10)
{
objetivo_minutos = "0" + objetivo_minutos;
} // end if
if (objetivo_minutos > 59)
{
objetivo_minutos = "00";
--horas;
} // end if

objetivo_horas = 23 - horas;

if (objetivo_horas < 10)
{
objetivo_horas = "0" + objetivo_horas;
} // end if
if (objetivo_horas == "0-1")
{
objetivo_horas = "23";
--D_faltan;
} // end if
if (objetivo_horas == "0-2")
{
objetivo_horas = "22";
--D_faltan;
} // end if


if (D_faltan < 10)
{
D_faltan2 = "00" add D_faltan;
}
else if (D_faltan < 100)
{
D_faltan2 = "0" add D_faltan;
}
else
{
D_faltan2 = String(D_faltan);
} // end else if
if (mbsubstring(D_faltan, 1, 2) == "0-")
{
contador.text = "El día ha llegado";
segundos_.text = "";
minutos_.text = "";
horas_.text = "";
dias_.text = "";
}
else
{
contador.text = "FALTAN DIAS HORAS MINUTOS SEGUNDOS";
segundos_.text = objetivo_segundos;
minutos_.text = objetivo_minutos;
horas_.text = objetivo_horas;
dias_.text = D_faltan;
trace(horas_.text);
} // end else if