Django获取小时内的数据
代码如下:
# 获取三个小时内的数据 hour_ago = datetime.datetime.now() - datetime.timedelta(hours=3) current_time = datetime.datetime.now() online_obj=models.table.objects.filter(create_time__gt=hour_ago)
代码如下:
# 获取三个小时内的数据 hour_ago = datetime.datetime.now() - datetime.timedelta(hours=3) current_time = datetime.datetime.now() online_obj=models.table.objects.filter(create_time__gt=hour_ago)