Foros del Web » Programando para Internet » ASP Clásico »

Hacer diferencia entre una hora y otra ora...

Estas en el tema de Hacer diferencia entre una hora y otra ora... en el foro de ASP Clásico en Foros del Web. hola amigos como estan.. bueno a lo que vinimos.. bueno tengo el siguiente problema estoy haciendo unprogramita para un internet en baces de datos acces. ...
  #1 (permalink)  
Antiguo 03/05/2008, 10:54
Avatar de mrjhon  
Fecha de Ingreso: junio-2005
Mensajes: 155
Antigüedad: 19 años, 10 meses
Puntos: 0
Hacer diferencia entre una hora y otra ora...

hola amigos como estan.. bueno a lo que vinimos..
bueno tengo el siguiente problema estoy haciendo unprogramita para un internet en baces de datos acces.
entonces cuando yo quiero mostar el tiempo en que la persona inicia en internet y cuando voy a mostar el tiempo en que termina.. ahy es donde tengo el error., me sale siempre un ocho .... y no se como organizar esto ahyy voy a postear todos los codigos que tengo del problema.. es urgente graicas..

4 INTERNET 1 Reprog.
H.INI TIME H.FIN
11:29 30 8 11: <<<<<< este es el error. y me debe salir 11:59 . como lo organizo.. gracias de nuevo

<%@ LANGUAGE="VBSCRIPT" %>

<title>THeka2</title>
</head>

<body bgcolor="#2080A0">

<div align="center">
<%
Fech=Date()

REQMET = Request.ServerVariables("REQUEST_METHOD")

If REQMET = "POST" Then
T3=request.form("Temp")
T3A=Left(T3,5)
Pro =request.form("Lista1")

Set DB=Server.CreateObject("ADODB.Connection")
DB.Open "TELEFON"," ","digdream"

Busca= "SELECT * FROM Inter1"
Set Encontro=DB.Execute(Busca)

While not Encontro.eof

Ini=Encontro("TiempoIni")
Fin=Encontro("TiempoFin")
NPro=Encontro("TiempoTot")
Aho=Date&" "&Ini

Encontro.Movenext
Wend
If Fin="6:00:00" Then
T3A=Left(Ini,5)
If NPro=10000 Then
Final=Time()
Fin1=Fech&" "&Final
Ini1=Fech&" "&Ini
NPro=DateDiff("n",Ini1,Fin1)
End If
Hor=CInt(NPro)+CInt(Pro)
Tempo=DateAdd("n",Hor,Aho)
Tiemp1=Mid(Tempo,10,5)

ReGuarda= "UPDATE Inter1 SET TiempoTot=" & Hor & ""
Set ReAccion = DB.Execute(ReGuarda)

If Hor=10000 Then
Hor="OPEN"
Tiemp1=0
End If
Encontro.Close%>

<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><p align="left"><a href="THeka5.asp" STYLE="COLOR:#202060; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;4</font></a></p></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;INTERNET 1</big></sup></font></td>
<td><p align="left"><a href="Heka2a.asp" STYLE="COLOR:#C0C0C0; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;Reprog.</font></a></p></td>
</tr>
</table>

<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.INI</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;TIME</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.FIN</big></sup></font></td>
</tr>
<tr>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><big>&nbsp;<%=T3A%></big></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><big>&nbsp;<%=Hor%></big></font></td>
<td><font size="2.5" face="Arial Black" color="#202060"><big>&nbsp;<%=Tiemp1%></big></font></td>
</tr>
</table>

<%Else
If Pro="OPEN" Then
Pro=10000
End If
Guarda= "INSERT INTO Inter1 (TiempoIni,TiempoFin,TiempoTot)"
Guarda= Guarda & "VALUES ('" & T3 & "','6:00'," & Pro & ")"
Set Accion = DB.Execute(Guarda)%>
<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><p align="left"><a href="THeka5.asp" STYLE="COLOR:#202060; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;4</font></a></p></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;INTERNET 1</big></sup></font></td>
<td><p align="left"><a href="Heka2a.asp" STYLE="COLOR:#C0C0C0; TEXT-DECORATION:NONE";>
<font size="2.5" face="Arial Black">&nbsp;Reprog.</font></a></p></td>
</tr>
</table>
<table border="1" cellpadding="1" cellspacing="0" width="100%" >
<tr>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.INI</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;TIME</big></sup></font></td>
<td><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>&nbsp;H.FIN</big></sup></font></td>
</tr>
<% Select case Pro
Case "10000"
Hor="OPEN"
Tiemp1=0
Case "60"
Hor=Pro
Tempo=DateAdd("h",1,Now())
Tiemp1=Mid(Tempo,10,5)
Case Else
Hor=CInt(Pro)
Tempo=DateAdd("n",Hor,Now())
Tiemp1=Mid(Tempo,10,5)
End Select

etc....

cuando le doy a programar me sale este pagina y este es el codigo

<%@ LANGUAGE="VBSCRIPT" %>

<title>Heka2</title>
</head>

<%
Tiemp=Time()
Tiemp1=Left(Time(),5)
%>
<table border="1" cellpadding="1" cellspacing="0" width="100%" ><form METHOD="POST" ACTION="THeka2.asp" name="Form16">
<input type="hidden" name="Temp" value="<%=Tiemp%>">
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>HORA ACT.</big></sup></font></td>
<td><center><font size="2.5" face="Arial Black" color="#202060"><sup><big><%=Tiemp1%></big></sup></font></center></td>
</tr>
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>PROG</big></sup></font></td>
<td><center><select name="lista1">
<option>15
<option selected>30
<option>60
<option>OPEN
</select></center></td>

etc...

este es el que tengo cuando le doy continuar algun tiempo 30 - 60 - o abierto o finalizar el tiempo y me sale el resultado en pesos = dinero

<title>Heka2</title>

<%
Tiemp=Time()
Tiemp1=Left(Time(),5)
%>
<table border="1" cellpadding="1" cellspacing="0" width="100%" ><form METHOD="POST" ACTION="THeka2.asp" name="Form16">
<input type="hidden" name="Temp" value="<%=Tiemp%>">
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>HORA ACT.</big></sup></font></td>
<td><center><font size="2.5" face="Arial Black" color="#202060"><sup><big><%=Tiemp1%></big></sup></font></center></td>
</tr>
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>PROG</big></sup></font></td>
<td><center><select name="lista1">
<option>15
<option selected>30
<option>60
<option>OPEN
</select></center></td>
</tr>

etc...

este es para reprogramar el tiempo en caso de reiniciar la pagina o se cierre el programa..

<%@ LANGUAGE="VBSCRIPT" %>
<%Response.Buffer = True %>
<title>Heka2c</title>

Set DB=Server.CreateObject("ADODB.Connection")
DB.Open "TELEFON"," ","digdream"

Busca= "SELECT * FROM Inter1"
Set Encontro=DB.Execute(Busca)

While not Encontro.eof

Ini=Encontro("TiempoIni")
Fin=Encontro("TiempoFin")
Pro=Encontro("TiempoTot")

Encontro.MoveNext
Wend

If Fin="6:00:00" Then

Saca= "UPDATE Inter1 SET TiempoTot='0'"
Set ReSaca=DB.Execute(Saca) %>


<% DB.Close

Else

Response.Clear
Response.Redirect "THeka2.asp"

End If%>
y este es el otro codigo

<%@ LANGUAGE="VBSCRIPT" %>

<title>HEKA2B</title>

<%
F1 = request.form("F1")
F2 = request.form("F2")

if F1 = "ON" and not F2 = "ON" then
%>

<table border="1" cellpadding="1" cellspacing="0" width="100%" ><form METHOD="POST" ACTION="THeka2.asp" name="Form16">
<tr>
<td width="70%"><font size="2.5" face="Arial Black" color="#FFFFFF"><sup><big>PROG</big></sup></font></td>
<td><center><select name="lista1">
<option>15
<option selected>30
<option>60
<option>OPEN
</select></center></td>

<%Else

if F2= "ON" and not F1="ON" then

Set DB=Server.CreateObject("ADODB.Connection")
DB.Open "TELEFON"," ","digdream"

Sacar= "SELECT TiempoIni,TiempoFin,TiempoTot FROM Inter1"
Set Encont=DB.Execute(Sacar)

While not Encont.eof

Fin=Encont("TiempoFin")
Dest=Encont("TiempoTot")
Ini=Encont("TiempoIni")

Encont.MoveNext
Wend

Fech=Date()
Final=Time()
Fin1=Fech&" "&Final
Ini1=Fech&" "&Ini
Gap=DateDiff("n",Ini1,Fin1)

if Dest="OPEN" Then
Dest=Gap
End if

VR1=Int(Gap/60)
VR2=Gap-(VR1*60)

Buscar= "SELECT Valor FROM PrecioInter WHERE Descripcion='Hor'"
Set Resultar = DB.Execute(Buscar)

Preh=Resultar("Valor")
Resultar.Close

If VR2>3 And VR2<=18 Then

Buscar1= "SELECT Valor FROM PrecioInter WHERE Descripcion='Qto'"
Set Resulta = DB.Execute(Buscar1)
Prem=Resulta("Valor")
Resulta.Close

End if
If VR2>18 And VR2<=33 Then
Buscar1= "SELECT Valor FROM PrecioInter WHERE Descripcion='Med'"
Set Resulta = DB.Execute(Buscar1)
Prem=Resulta("Valor")
Resulta.Close
End if
If VR2>33 And VR2<=48 Then
Buscar1= "SELECT Valor FROM PrecioInter WHERE Descripcion='Tqto'"
Set Resulta = DB.Execute(Buscar1)
Prem=Resulta("Valor")
Resulta.Close
End If
If VR2>48 And VR2<=59 Then
Prem=Preh
End If
Tot=(VR1*Preh)+Prem
Subt=Tot/1.16
Tax=(Subt*16)/100


Guarda= "INSERT INTO Internet(CodItem, Pc, TiempoIni, TiempoFin, TiempoTot, Subtotal, iva, Valor, Fecha)"
Guarda= Guarda & "VALUES('GC02','Heka2','" & Ini & "','" & Final & "','" & Gap & "','" & Subt & "','" & Tax & "','" & Tot & "','" & Fech & "')"
Set ReAccion = DB.Execute(Guarda)

Saca= "DELETE FROM Inter1 WHERE TiempoTot=" & Dest & ""
Set ReSaca=DB.Execute(Saca)%>

<etc...

gracias de antemano por la ayuda que me puedan brindar y perdonen postear todos esos codigos pero es para una mejor guia de mi error gracias....
  #2 (permalink)  
Antiguo 05/05/2008, 17:14
Avatar de mrjhon  
Fecha de Ingreso: junio-2005
Mensajes: 155
Antigüedad: 19 años, 10 meses
Puntos: 0
Re: Hacer diferencia entre una hora y otra ora...

HOLA AMIGOS....

QUE PASA CON EL POST ESTA MUY DIFICIL LO QUE LES PIDO O ES QUE NO ME ENTIENDEN.
JAJAJA


BUENO DE OTRA MANERA HABER SI DEPRONTO ME ENTIENDEN.


LO QUE DESEO ES QUE AL YO PROGRAMAR UNA HORA PARA INTERNET

ME MUESTRA LA HORA INICIAL Y LA HORA QUE TERMINA

EJEMPLO

H. DE INICIO TIEMPO QUE ELIGO DE UNA LISTA Y H. FINAL
10.30 30 11.00

con que formula puedo hacer esto para que me muestre la H. FINAL


EN EL POST ESTAN LAS PAGINAS QUE HE CREADO

pero el error me da cuando me muestra la hora final.
me sale esto

8 11: <<<<<< fijesen que no me sale 11:00 si no esto 8 11: no se de donde me sale el 8<<<<<<.



gracias por la ayuda .

creo saber que depronto es esto lo que esta malo pero necesito la ayuda de ustedes..

<% Select case Pro
Case "10000"
Hor="OPEN"
Tiemp1=0
Case "60"
Hor=Pro
Tempo=DateAdd("h",1,Now())
Tiemp1=Mid(Tempo,10,5)
Case Else
Hor=CInt(Pro)
Tempo=DateAdd("n",Hor,Now())
Tiemp1=Mid(Tempo,10,5)
End Select
  #3 (permalink)  
Antiguo 06/05/2008, 12:02
Avatar de JuanRAPerez
Colaborador
 
Fecha de Ingreso: octubre-2003
Mensajes: 2.393
Antigüedad: 21 años, 6 meses
Puntos: 27
Re: Hacer diferencia entre una hora y otra ora...

jejeje es que da hueva leer tanto código.
mas sin etiquetas
jejejeje

+ de donde retraes las horas? de una base
+ ese campo es hora almacenada o un string?
+ has visto si guarda 09:09:09 o 9:09:09 ????

usas la función time de alguna forma?


suerte
__________________
JuanRa Pérez
San Salvador, El Salvador
  #4 (permalink)  
Antiguo 06/05/2008, 16:27
Avatar de mrjhon  
Fecha de Ingreso: junio-2005
Mensajes: 155
Antigüedad: 19 años, 10 meses
Puntos: 0
Re: Hacer diferencia entre una hora y otra ora...

jajja ya pensaba yo que es sierto que da huevera leer todo esto jaja.

la hora de inicio queda almacenada en la base de datos la hora inicial es 11:00 y guarda en el otro campo 06:00:00 que es el que dice hora final..

pero ya pude arreglar lo de la diferencia poniedole al tempo1 10,60

Tiemp1=Mid(Tempo,10,60) en toda hepuesto el 60 y me funciono...

asi de esta manera epodido arreglarla per me sigue saliendo el 8<<<<<::???
  #5 (permalink)  
Antiguo 07/05/2008, 08:17
Avatar de JuanRAPerez
Colaborador
 
Fecha de Ingreso: octubre-2003
Mensajes: 2.393
Antigüedad: 21 años, 6 meses
Puntos: 27
Re: Hacer diferencia entre una hora y otra ora...

jajaja insisto da hueva leer el código

pero si ya te funciona que bien.
__________________
JuanRa Pérez
San Salvador, El Salvador
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:24.