小编BLA*_*HER的帖子

从日期时间列表中获取最早和最晚时间

我有,

timestamp=[]
for x in model_obj:
     timestamp.append(x.start_time)

print timestamp
Run Code Online (Sandbox Code Playgroud)

结果:

[datetime.datetime(2014, 9, 2, 19, 40, 1, tzinfo=<UTC>), datetime.datetime(2014, 9, 2, 19, 40, 14, tzinfo=<UTC>), datetime.datetime(2014, 9, 2, 19, 40, 7, tzinfo=<UTC>), datetime.datetime(2014, 9, 2, 21, 53, tzinfo=<UTC>), datetime.datetime(2014, 9, 2, 22, 25, 24, tzinfo=<UTC>), datetime.datetime(2014, 9, 2, 22, 2
5, 52, tzinfo=<UTC>)]
Run Code Online (Sandbox Code Playgroud)

我的问题是:如何从python的这个日期时间列表中获取最早和最晚的时间?

python django datetime

4
推荐指数
1
解决办法
1599
查看次数

标签 统计

datetime ×1

django ×1

python ×1