user13760622
user13760622

Reputation:

Date time function

Hi there I am creating a Flask application and I want to find out the number of days left to a certain date let's say 2nd of August. How would I do so.

Upvotes: 0

Views: 50

Answers (1)

Huzaifa Ahmad
Huzaifa Ahmad

Reputation: 31

You can use the datetime library to do that:

from datetime import date
start_date = date(2020, 6, 2)
end_date = date(2020, 6, 11)
delta = start_date - end_date
print(delta.days)

Upvotes: 2

Related Questions