Skip to content
Advertisement

how can i calculate the difference between two dates and times in python

my code looks like this:

JavaScript

listaDivisa looks like this:

JavaScript

I want to calculate how much time (better in minutes) the sensor was ON, I tried doing this:

JavaScript

but it doesn’t work, another raw alternative I tried was

JavaScript

but, not minding about the fact that it doesn’t even work, I don’t think it could be a smart alternative.

How could I do that? Thank you

Advertisement

Answer

Ignoring how listaDivisa is constructed in OP’s code then this may help:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement