def query_parameters(self): dates = self.date_interval.dates() # pylint: disable=no-member start_date = dates[0] # Note that we could probably use the end date at 23:59:59, however, it's easier to just add a day and use the # next day as an excluded upper bound on the interval. So we actually select all data earlier than # 00:00:00.000 on the day following the last day in the interval. end_date = dates[-1] + datetime.timedelta(1) return (mysql_datetime(start_date), mysql_datetime(end_date))
def test_mysql_timestamp(self): string_timestamp = '2014-01-02 13:10:11' timestamp = datetime.datetime.strptime(string_timestamp, '%Y-%m-%d %H:%M:%S') self.assertEquals(mysql_datetime(timestamp), string_timestamp)