Every line of 'convert timedelta to days' 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.
26 def days_ago(days): 27 """ 28 Returns datetime object 29 """ 30 return datetime.date.today() - datetime.timedelta(days=days)
12 def add_days_delta(date_from, days_delta): 13 if not date_from: 14 return date_from 15 next_date = fields.Date.from_string(date_from) + timedelta(days=days_delta) 16 return fields.Date.to_string(next_date)
39 def seconds_to_timedelta(value): 40 """ 41 Converst the given value in secodns to datetime.timedelta. 42 """ 43 _days = value // 86400 44 _hours = (value // 3600) % 24 45 _mins = (value // 60) % 60 46 _secs = value % 60 47 return timedelta(days=_days, hours=_hours, minutes=_mins, seconds=_secs)
669 def _convert_to_timedelta(self, seconds, millis=True): 670 return timedelta(seconds=seconds)