[go: nahoru, domu]

Skip to Content
Menu
This question has been flagged
1 Reply
84 Views

How can I find the difference between dates in two fields?

How do I find the difference between 2 dates?

Avatar
Discard
Best Answer

Hi,

You can refer to this code and modify it according to your field requirements.


from datetime import datetime


start_date = self.start_date

end_date = self.end_date


difference_days = (end_date - start_date).days

years = difference_days / 365.25

Avatar
Discard