码迷,mamicode.com
首页 > 编程语言 > 详细

python 计算 crontab 下次执行时间

时间:2019-01-09 11:40:53      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:执行时间   时间   tab   ftime   run   sch   pre   turn   install   

python3.6 -m pip install croniter

import croniter
import datetime

def run_get_next_time(sched):
    now = datetime.datetime.now()
    cron = croniter.croniter(sched, now)
    return [cron.get_next(datetime.datetime).strftime("%Y-%m-%d %H:%M")][0]

print(run_get_next_time("* * * * *"))

python 计算 crontab 下次执行时间

标签:执行时间   时间   tab   ftime   run   sch   pre   turn   install   

原文地址:http://blog.51cto.com/hequan/2340169

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!