USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  calculo de tempo
heber
não registrado
ENUNCIADA !
Postada em 12/11/2009 12:31 hs   
boa tarde pessoal!
preciso calcular o tempo em um relatorio...  to gravando em campo tipo texto
ex: 10:25 15:10 somar horas e minutos... hh:mm
alguem pode me ajudar?
Obrigado...
   
PH1959
Pontos: 2843
SÃO JOSÉ DOS CAMPOS
SP - BRASIL
ENUNCIADA !
Postada em 12/11/2009 15:47 hs            
de onde vc está pegando a hora inicial e final? ela está sendo digitada?
   
heber
não registrado
Postada em 12/11/2009 15:56 hs   
na vdd... é um campo .. de Tempo... q é informado o tempo q foi gasto para atender o cliente!
o usuário informa o tempo gasto , em HH:MM
 
     
PH1959
Pontos: 2843
SÃO JOSÉ DOS CAMPOS
SP - BRASIL
Postada em 12/11/2009 15:59 hs            
isso vai armazenar em um bd?
 
     
heber
não registrado
Postada em 12/11/2009 16:02 hs   
isso .. esta sendo armazenado em um banco em access , em um campo texto...
     
PH1959
Pontos: 2843
SÃO JOSÉ DOS CAMPOS
SP - BRASIL
ENUNCIADA !
Postada em 12/11/2009 16:42 hs            
testa aí
SEM ARMAZENAR em bd ou armazenando em formatos diferentes de DATA/HORA
Supondo q vc tenha 2 textbox
1 text_hora_inicial
1 text_hora_final

para os textbox eu usaria 'O usuario deverá digitar somente os numeros da hora de 0000 a 2359 ok?
no declarations coloca
dim hini(1) as byte
dim hfim(1) as byte
dim mintotal as byte
dim horatotal as byte
private sub text_hora_inicial_lost_focus()
x=text_hora_inicial.text
hini(0)=int(x/100)
hini(1)=x mod 100

text_hora_inicial.text=(format(text_hora_inicial.text,"00":00")
end sub
private sub text_hora_final_lost_focus()
x=text_hora_final.text
hfim(0)=int(x/100)
hfim(1)=x mod 100
text_hora_final.text=(format(text_hora_final.text,"00":00")
end sub

private sub calculatempo ' Válido para tempo menor do q 24 horas
    if hfim(0)< hini(0) then
        hfim(0)=hfim(0)-12
        hini(0)=hini(0)-12
    else
    endif
         
if hfim(1)< hini(1) then
        hfim(0)=hfim(0)-1
        mintotal= hfim(1)+(60-hini(1))
        horatotal= hfim(0)-hini(0)
 
    else
        if hfim(1)= hini(1)
          mintotal= 0
          horatotal= hfim(0)-hini(0)
        else  'hfim (1)>hini(1)
          mintotal= ( hfim(1)+(60-hini(1)))-60
          horatotal= hfim(0)-hini(0)+1
           
    endif
label_tempodecorrido.caption=format(horatotal,"00") &":" & format(mintotal,"00")
 
 
Não eskeça de dizer se funcionou e encerrar o tópico
TÓPICO EDITADO
 
Página(s): 1/4      PRÓXIMA »


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2025   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página