CONVERSAO
[S24] COMO FAÇO PRA CONVERTER UM CAMPO TEXTO EM HORA?
talvez estes dois pontos ajudem
Public Function SegToHora(ByVal STH As String) As String
Dim Hora As Double
Dim Minutos As Double
Dim Valor As Double
Dim Segundos As String
If IsNumeric(STH) = False Then Exit Function
Valor = CDbl(STH)
'Transforma valor em hh:mm:ss
Hora = Format$((Valor \ 3600), "0#")
Minutos = Format$(((Valor Mod 3600) \ 60), "0#")
Segundos = Format$(((Valor Mod 3600) Mod 60), "0#")
SegToHora = Format$(Hora, "0#") & ":" & Format$(Minutos, "0#") & ":" & Format$(Segundos, "0#")
End Function
Public Function HoraToSeg(ByVal HTS As String) As String
Dim hh As Integer
Dim mm As Integer
Dim ss As Integer
Dim horaatual As Double
'Converte de horas para segundos
'recebe hora no formato hh:mm:ss
If HTS = "" Then Exit Function
'Pega a hora
hh = Format(Mid$(HTS, 1, 2), "0#")
mm = Format(Mid$(HTS, 4, 2), "0#")
ss = Format(Mid$(HTS, 7, 2), "0#")
horaatual = hh * 3600#
horaatual = horaatual + (mm * 60#) + ss
HoraToSeg = CStr(horaatual)
End Function
Public Function SegToHora(ByVal STH As String) As String
Dim Hora As Double
Dim Minutos As Double
Dim Valor As Double
Dim Segundos As String
If IsNumeric(STH) = False Then Exit Function
Valor = CDbl(STH)
'Transforma valor em hh:mm:ss
Hora = Format$((Valor \ 3600), "0#")
Minutos = Format$(((Valor Mod 3600) \ 60), "0#")
Segundos = Format$(((Valor Mod 3600) Mod 60), "0#")
SegToHora = Format$(Hora, "0#") & ":" & Format$(Minutos, "0#") & ":" & Format$(Segundos, "0#")
End Function
Public Function HoraToSeg(ByVal HTS As String) As String
Dim hh As Integer
Dim mm As Integer
Dim ss As Integer
Dim horaatual As Double
'Converte de horas para segundos
'recebe hora no formato hh:mm:ss
If HTS = "" Then Exit Function
'Pega a hora
hh = Format(Mid$(HTS, 1, 2), "0#")
mm = Format(Mid$(HTS, 4, 2), "0#")
ss = Format(Mid$(HTS, 7, 2), "0#")
horaatual = hh * 3600#
horaatual = horaatual + (mm * 60#) + ss
HoraToSeg = CStr(horaatual)
End Function
falha minha
tenta assim
CDate(hora / 100000)
tenta assim
CDate(hora / 100000)
Tópico encerrado , respostas não são mais permitidas