我有time字符串,它以ISO8601格式表示时间。
格式为日期的公式:{{ time.strftime('%Y-%m-%d') }}
电流输出:
time = 2018-01-23T08:11:58.000000
output: 2018-01-23我想把它分成6个小时:
time = 2018-01-23T08:11:58.000000
output: 2018-01-23_1 // last "1" represents second span of 6 hours in 24 hours day (6-12)为了实现这一点,我需要在我的公式中添加什么?
发布于 2018-01-25 10:33:53
hour除以6。
{{ time.strftime('%Y-%m-%d') }}_{{ time.strftime('%H')/6 }}并得到了结果:
2018-01-23_1 // for hours 6-12
2018-01-23_2 // for hours 12-18不知道为什么不能早点想到这个简单的逻辑。
https://stackoverflow.com/questions/48439381
复制相似问题