Python Get Current Day Example Tutorial

Published On: 27/08/2022 | Category: Python


Hi Guys,

Now, let's see post of python get current day example. it's simple example of how to get current day in python. In this article, we will implement a how to get current day in python 3. you will learn python get today day.

In this post, i will give you three examples to getting current day in python. we will use datetime module to get current day from date. so let's see following examples with output:

So let's see bellow example:

Example 1: main.py
from datetime import datetime
  
today = datetime.now()
  
print("Current Date and Time :", today)
print("Current Day :", today.day)
Output:
Current Date and Time : 2022-08-27 05:21:59.477943
Current Day : 27
Example 2: main.py
from datetime import datetime
  
today = datetime.now()
  
day1 = today.strftime("%d")
print("Current Day with zero :", day1);
  
day2 = today.strftime("%-d")
print("Current Day :", day2);
Output:
Current Day with zero : 27
Current Day : 27

It will help you....