date() function in python by R4R Team

- date() is a python function which is defined in datetime module, that return the date based on the given year,month and day.

Syntax-

calendar.datetime.date(year,month,day)


program-

#import calendar module
import calendar

print("Enter year")
y=int(input())
print("Enter month")
m=int(input())
print("Enter day")
d=int(input())

print("Date is ",calendar.datetime.date(y,m,d))


output-

Enter year
2020
Enter month
3
Enter day
5
Date is 2020-03-05




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!