Content

General description

Code to obtain the difference between datetimes. In the example variable dif is the result of the operation.

Solution

DAYS

import datetime
a = datetime.datetime.(year, month, day, hours, minutes, seconds, 0)
b = datetime.datetime.now()
c = b - a
dif = c.days

MINUTES

import datetime a = datetime.datetime.(year, month, day, hours, minutes, seconds, 0)
b = datetime.datetime.now()
c = b - a
dif = c.days * 86400 + c.seconds/60

Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: October 18, 2018