1
I’m taking 2 strings in the format hh:mm:ss to then calculate the time spent between them in days, hours, minutes and seconds format.
I have already split and have all fields separated into their own variables of the whole type, for example: hora_inicio, minuto_inicio
, etc. However, I am having trouble conversions minutes x hours, seconds x minutes, etc.
Is there any way I can "assemble" a time-type variable with these variables of mine hora_inicio, minuto_inicio
to make it easier to calculate the time spent?
How will you calculate the interval in days if the strings only talk about hours, minutes and seconds?
– Pablo Almeida
@Pabloalmeida days are sent directly by other input
– Evilmaax
You just want to know how to create
datetime
s for those hours?– Pablo Almeida
exact. I want to know how to use hh to compose the one referring to the hour, mm to the field referring to the seconds, etc.
– Evilmaax
As an observation, you don’t need to split; just use the
datetime.strptime
.– Pedro von Hertwig Batista