Every line of 'get hour from datetime 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.
143 def hoursLater(date, h): 144 return date + + timedelta(hours=h)
3 def hour_to_time(hour): 4 return "%2i:%02i" % (math.floor(hour), (hour - math.floor(hour)) * 60)
215 @property 216 def float_hour(self): 217 """Get hour and minute as a float value, e.g. 6.25 for 6:15.""" 218 return self.hour + self.minute / 60.0
342 def hour(self, column=None, keep=False): 343 return self._generic(name='_hour', column=column, keep=keep, multiple=True)
657 def setTime(date, hour, minute, second): 658 """Takes in a date, and returns a copy of it with the time fields 659 set as specified. 660 661 Args: 662 date (datetime): The starting date. 663 hour (int): The hours (0-23) to set. 664 minute(int): The minutes (0-59) to set. 665 second (int): The seconds (0-59) to set. 666 667 Returns: 668 datetime: A new date, set to the appropriate time. 669 """ 670 return date.replace(hour=hour, minute=minute, second=second, microsecond=0)
72 def setHour(self, hour): 73 self.calendar = datetime(self.calendar.year, self.calendar.month, self.calendar.day, hour, self.calendar.minute, self.calendar.second, self.calendar.microsecond, self.calendar.tzinfo)
74 def test_get_hour(self): 75 self.assertEqual( 76 meterbus.DateCalculator.getHour(255), 77 31, 78 )
26 def strHoursToTimeDelta(hoursAsString): 27 return dt.timedelta(hours=int(hoursAsString))
28 def get_alarm_hour(alarm_time): 29 if alarm_time.hour == 1: # word correction 30 alarm_hour = "ein" 31 else: 32 alarm_hour = alarm_time.hour 33 return alarm_hour