python简单的计算过期时间的源码

发布时间:2020-07-06 11:22:36 作者:sunflower2091
来源:网络 阅读:299

把开发过程中较好的内容片段记录起来,下面的内容段是关于python简单的计算过期时间的 的内容,应该能对大伙也有好处。

def time_passed(value):
    now = datetime.now()
    past = now - value
    if past.days:
        return u'%s天前' % past.days
    mins = past.seconds / 60
    if mins < 60:
        return u'%s分钟前' % mins
    hours = mins / 60
    return u'%s小时前' % hours
推荐阅读:
  1. Local Storage过期时间
  2. redis如何设置过期时间

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

过期时间

上一篇:OpenCV中的新函数connectedComponentsWithStats有什么用

下一篇:关于MySQL索引的简介

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》