- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the first date of a given year using Python?
In this program, we have to print the first day of the year. We have to take a year as a user input.
Step 1: Import the datetime library. Step 2: Take year as input from the user. Step 3: Get the first day of the year by passing month, day and year as parameters to the datetime.datetime() function Step 4: Display the first day using strftime() function.
import datetime year = int(input("Enter year: ")) firstday = datetime.datetime(year, 1,1) print("First Day of ", year, " = ", firstday.strftime("%A"))
First Day of 2021 = Friday
- Write a program in Python to print the day of the year in a given date series
- Python Pandas - Indicate whether the date in DateTimeIndex is the first day of the year
- How to check if a year is a leap year using Python?
- Find the index of the first unique character in a given string using C++
- Program to find maximum population year using Python
- How to find the number of digits in a given number using Python?
- How to find a leap year using C language?
- Write a program in Python to split the date column into day, month, year in multiple columns of a given dataframe
- Java program to find if the given number is a leap year?
- How to print a calendar for the given month and year in Python?
- How to detect if a given year is a Leap year in Oracle?
- How to Check Leap Year using Python?
- Program to find the index of first Recurring Character in the given string in Python
- Python Pandas - Get the week of the year on the given Period
- How to find leap year or not in android using year API class?