⊗pyPmTmCD 185 of 208 menu

Printing Current Date in Python

To display the current date, you need to successively apply the date and today methods to the datetime module.

Let's display the current date:

res = datetime.date.today() print(res) # will display the current date

Now let's get the current day, month and year:

print(res.day) # the day print(res.month) # the month print(res.year) # the year

Print the current day to the console.

Display the current month in the console.

Output the current year to the console.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline