Python – get current date
Hi, here is a sample for getting current date and print it. There are various string formating that you can choose regarding to your needs.
In order to drop the leading zero (01/09/2018 > 1/9/2018) you can apply “-” or “#”. I added a comment for this.
from datetime import date #gun=date.today() #gun1=gun.strftime("%Y/%m/%d") #print(gun.strftime("%Y/%m/%d")) #print(gun1) def get_todays_date(): gun = date.today() gun1 = gun.strftime("%Y/%#m/%#d") #windows pc'lerde # , linux vb. de # yerine - return gun1 print(get_todays_date())