Calcular Data/Hora
Bom estou usando esta função para me retornar os Minutos entre duas datas e horas.
MinutesBetween( StrToDateTime(´25/01/2006 12:00:00´), StrToDateTime(´25/01/2006 12:16:01´));
Quanto uso Assim a função me retorna 16 minutos
mas quando uso assim tirando o segunto me retora 15 quando me deveria retorna 16.
MinutesBetween( StrToDateTime(´25/01/2006 12:00:00´), StrToDateTime(´25/01/2006 12:16:00´));
Se tiver um jeito menhor tb server.
Desde já obrigado!
MinutesBetween( StrToDateTime(´25/01/2006 12:00:00´), StrToDateTime(´25/01/2006 12:16:01´));
Quanto uso Assim a função me retorna 16 minutos
mas quando uso assim tirando o segunto me retora 15 quando me deveria retorna 16.
MinutesBetween( StrToDateTime(´25/01/2006 12:00:00´), StrToDateTime(´25/01/2006 12:16:00´));
Se tiver um jeito menhor tb server.
Desde já obrigado!
Leorez
Curtidas 0
Respostas
Aroldo Zanela
25/01/2006
Colega,
Veja uma solução:
Veja uma solução:
var Min1, Min2: Integer; begin Min1 := MinutesBetween( StrToDateTime(´25/01/2006 12:00:00´), StrToDateTime(´25/01/2006 12:16:00´)); Min2 := Round(Abs(StrToDateTime(´25/01/2006 12:00:00´) - StrToDateTime(´25/01/2006 12:16:00´)) * 24 * 60); ShowMessage(IntToStr(Min1)+ ´ ´+IntToStr(Min2));
GOSTEI 0
Emerson Nascimento
25/01/2006
tente assim:
RoundTo(MinuteSpan(StrToDateTime(´25/01/2006 12:00:00´), StrToDateTime(´25/01/2006 12:16:00´)),0)
a função RoundTo() está na unit Math.
RoundTo(MinuteSpan(StrToDateTime(´25/01/2006 12:00:00´), StrToDateTime(´25/01/2006 12:16:00´)),0)
a função RoundTo() está na unit Math.
GOSTEI 0