Every line of 'last day of month python' 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.
87 def last_monthday(self, day): 88 ''' 89 Returns ``True`` if the given ``day`` (datetime/date) instance is the 90 last trading day of this month 91 ''' 92 # Next day must be greater than day. If the week changes is enough for 93 # a week change even if the number is smaller (year change) 94 return day.month != self._nextday(day)[0].month
6 def dayOfMonth(M): 7 return (28 if (M == 2) else 31-(M-1)%7%2)
721 def first_day_of_month(date): 722 ddays = int(date.strftime("%d")) - 1 723 delta = timedelta(days=ddays) 724 return date - delta
149 def daysInMonth(self, month): 150 """returns last day of the month as integer 28-31""" 151 if self.isLeapYear(): 152 return _daysInMonthLeapYear[month - 1] 153 else: 154 return _daysInMonthNormal[month - 1]
270 @property 271 def days_in_month(self): 272 return self.date.days_in_month
107 def getDaysInMonth(self, mth, year): 108 days = 0 109 if mth in [1, 3, 5, 7, 8, 10, 12]: 110 days = 31 111 elif mth in [4, 6, 9, 11]: 112 days = 30 113 elif (mth == 2 and self.isLeapYear(year)): 114 days = 29 115 else: 116 days = 28 117 return days