Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support for year in Croniter #76

Closed
pattu777 opened this issue Jan 4, 2017 · 6 comments
Closed

Support for year in Croniter #76

pattu777 opened this issue Jan 4, 2017 · 6 comments

Comments

@pattu777
Copy link

pattu777 commented Jan 4, 2017

I want to execute a job at 6 AM on 2nd, Feb 2018 only once. The corresponding cron expression would be "0 6 2 2 * 0 2018".

In croniter, seconds is the 6th part of the cron expression. But I am getting CroniterBadError when I try to provide year also. Is there any way to accomplish this. Or this might be a new feature request.

@m0nzderr
Copy link

+1

@kiorky
Copy link
Collaborator

kiorky commented Aug 31, 2017

No, seconds is not the 6th part.
Cf https://en.wikipedia.org/wiki/Cron#Overview

@kiorky kiorky closed this as completed Aug 31, 2017
@holljen
Copy link

holljen commented Sep 27, 2017

Hang on, why is this closed..

First of all:

base = datetime(2010, 1, 25, 4, 46)
iter = croniter('* * * * * */5', base)
print(iter.get_next(datetime))
print(iter.get_next(datetime))
print(iter.get_next(datetime))

Prints:

2010-01-25 04:46:05
2010-01-25 04:46:10
2010-01-25 04:46:15

Sure looks like the 6th element is seconds to me. If it isn't, please clarify..

And also I'm confused why the year request was just disregarded if there are seconds. Then again, if seconds support is a bug... (which I rely on btw).

@pattu777
Copy link
Author

pattu777 commented Sep 28, 2017

Even I'm not sure why this was closed. Standard cron doesn't take year into account. So I thought it would be a new feature request.

Apart from that you're correct. This library treats the sixth field of a cron pattern as second.

@omkar-dsd
Copy link

Docs: http://www.nncron.ru/help/EN/working/cron-format.htm

  • Sixth Place should be optional for YEAR

  • Currently the sixth place is for Seconds

@kiorky
Copy link
Collaborator

kiorky commented Oct 8, 2021

croniter mostly sticks with the original 5fields cron format with some variations.

There are some bits with 6fields (seconds): https://github.com/taichino/croniter#about-second-repeats but not a full support.

PR are welcomes ;-)

@kiorky kiorky closed this as completed Oct 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants