Every line of 'python get current month' 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
12 def first_of_current_month(now=None): 13 """ 14 >>> d = datetime.datetime(2005, 7, 14, 12, 30) 15 >>> first_of_current_month(d) 16 datetime.datetime(2005, 7, 1, 12, 30) 17 """ 18 now = now or datetime.now() 19 return timestamp(now - timedelta(days=now.day-1))
36 def read_current_month(self): 37 month = c_uint(0) 38 39 if libdfhack.World_ReadCurrentMonth(self._world_ptr, byref(month)) > 0: 40 return int(month) 41 else: 42 return -1
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
68 def show_month(data): 69 return '{0:%b}'.format(data)
297 def get_monthrange(self, year, month): 298 """ 299 Returns days range and first weekday for specified date. 300 """ 301 day1 = self.get_weekday(year, month, 1)[0] 302 ndays = mdays[month] + (month == 2 and isleap(year)) 303 304 return day1, ndays