G
G
GreenX52020-06-02 03:03:42
Python
GreenX5, 2020-06-02 03:03:42

Python How many days have passed since "May 25"?

Good afternoon,
the date arrives in the format "25 May". You need to get how many days have passed from the system date. Excluding year. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2020-06-02
@GreenX5

>>> from datetime import datetime
>>> today = datetime.now()
>>> may_25 = datetime.strptime(f'25 May {today.year}', '%d %b %Y')
>>> (today - may_25).days
8

A
alfss, 2020-06-02
@alfss

https://www.geeksforgeeks.org/python-difference-be...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question