Every line of 'python get current date' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
9 def get_current_month_date(): 10 today = date.today() 11 datem = date(today.year, today.month, 1) 12 return datem
71 def getCurDate(): 72 d = datetime.datetime.today() 73 year = d.year 74 month = d.month 75 month = str(0)+str(month) if month<10 else str(month) 76 day = d.day 77 day = str(0)+str(day) if day<10 else str(day) 78 79 date = (day)+(month)+str(year) 80 81 return date
37 def get_current_time(): 38 return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
4 def current_date_time(): 5 time_format = "%Y-%m-%d %H:%M:%S" 6 return datetime.now().strftime(time_format)
78 def get_current_time(): 79 error_time = int(time.time()) # ->这是时间戳 80 error_time = time.localtime(error_time) 81 other_style_time = time.strftime("%Y-%m-%d %H:%M:%S", error_time) 82 return other_style_time
43 def get_date (self): 44 cd = time.strftime ("%Y%m%d", time.localtime (time.time ())) 45 self.lock.acquire () 46 if cd not in self.attain_status: 47 self.attain_status [cd] = 0 48 self.lock.release () 49 return cd
32 def date(): 33 return datetime.now()
10 def get_prev_month_date(): 11 today = date.today() 12 if today.day == 1: 13 if today.month == 1: 14 date_month = date(today.year - 1, 12, 1) 15 else: 16 date_month = date(today.year, today.month - 1, 1) 17 else: 18 date_month = date(today.year, today.month, 1) 19 return date_month
71 def get_today(self): 72 return datetime.datetime.today().date()
41 def date(): 42 return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")