S
S
splatt2016-11-05 05:19:04
Algorithms
splatt, 2016-11-05 05:19:04

How to find the previous start time of a task given the current time and cron type structure?

Having a scheduled task in the form of a cron structure (minute, hour, day of month, day of week, month), where each field is a list of possible values ​​(for example, 0th minute and 30th minute; all possible hours from 0 to 24, etc. ), how to find the previous task start time (knowing the current time)?
For example, the name of a structure like:
{
"minutes": [0, 30],
"hours": [0],
"days": [],
"days_of_week": [],
"months": []
}
(runs twice per day, every day, at 00:00 and 00:30);
And knowing the current time, let's say November 07, 2016 00:45, how to find the previous time (November 07, 2016, 00:30) ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question