Django将秒转换为xx天xx时xx分,具体代码如下所示: from django.utils.translation import ngettext_lazy as _n def humanize_seconds(secs): a_day = 86400 an_hour = 3600 a_minute = 60 timetot = '' total_secs = secs if secs > a_day: # 60sec * 60min * 24hrs days = int(secs // a_day) # timetot += {} {}.f