Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7003509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:04:41+00:00 2026-05-27T21:04:41+00:00

I’m building some software that needs a scheduling input, and I’d really like to

  • 0

I’m building some software that needs a scheduling input, and I’d really like to re-use the design of crontab because it simply works.

CrontabExpressions can be really simple */5 * * * * “run every five minutes” or more complex 2-59/3 1,9,22 11-26 1-6 ? 2003 “In 2003 on the 11th to 26th of each month in January to June every third minute starting from 2 past 1am, 9am and 10pm”.

I am not looking to use the linux software called crontab, I’m seeking a way I can evaluate these expressions correctly (for instance, output the next 25 timestamps that match the crontab, or generate it based on some abstracted GUI for the users).

I can’t really find any libraries or functions that do this in JavaScript or PHP or even other languages. If they don’t exist, what would be a good method to do this? I already know an overly-complicated regular expression is likely to be the wrong answer. I’m having a hard time finding the C source code in crontab that does this task as well, which makes me believe it might not take place here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:04:41+00:00Added an answer on May 27, 2026 at 9:04 pm

    To output the next 25 timestamps that match the crontab you could use crontab Python module:

    from datetime import datetime, timedelta
    import crontab
    
    tab = crontab.CronTab('2-59/3 1,9,22 11-26 1-6 ? 2012')
    
    dt = datetime.now()
    for _ in xrange(25):
        delay = tab.next(dt) # seconds before this crontab entry can be executed.
        dt += timedelta(seconds=delay)
        print(dt)
    

    Output

    2012-01-11 22:41:00
    2012-01-11 22:44:00
    2012-01-11 22:47:00
    2012-01-11 22:50:00
    2012-01-11 22:53:00
    2012-01-11 22:56:00
    2012-01-11 22:59:00
    2012-01-12 01:02:00
    2012-01-12 01:05:00
    2012-01-12 01:08:00
    2012-01-12 01:11:00
    2012-01-12 01:14:00
    2012-01-12 01:17:00
    2012-01-12 01:20:00
    2012-01-12 01:23:00
    2012-01-12 01:26:00
    2012-01-12 01:29:00
    2012-01-12 01:32:00
    2012-01-12 01:35:00
    2012-01-12 01:38:00
    2012-01-12 01:41:00
    2012-01-12 01:44:00
    2012-01-12 01:47:00
    2012-01-12 01:50:00
    2012-01-12 01:53:00
    

    There is also python-crontab that provides crontab module but with richer functionality (parse/generate).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.