+ 1

Hello :) how can the complete date of birth of the user be compared with the current date in the code?

So then i can write: "you are".. and not "you'll be.. years old" https://code.sololearn.com/c86ay45Dx1lP/?ref=app

23rd May 2023, 5:25 PM
Amandine Kos
Amandine Kos - avatar
3 Respostas
+ 6
Amandine Kos , > to handle date and time correctly, we need to convert the input to a *datetime-object*. to accomplish this, we need to import and use the *datetime* module. > to find the difference of 2 *datetime objects*, we need an other module named *dateutil* we have to import this module. for more details have a look in the attached file. (for more details have a look at the description of the *datetime* module): https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes https://code.sololearn.com/csrWYW25NzPT/?ref=app
23rd May 2023, 6:00 PM
Lothar
Lothar - avatar
+ 3
Look up the datetime module (part of the standard library, so ok to import in the sololearn playground), notably datetime.date
23rd May 2023, 5:40 PM
Orin Cook
Orin Cook - avatar
+ 1
Thank u! :))
23rd May 2023, 6:48 PM
Amandine Kos
Amandine Kos - avatar