Jump to content

CronToTime.au3 UDF - Cron expression parser


ergo
 Share

Recommended Posts

CronToTime.au3 UDF converts a Unix Cron expression into a DateTime string.
On Unix systems a Cron expression made of five fields separated by blanks/tabs followed by a shell command to execute.

e.g. 15-30 2,3,4,5 29 1-12 0-6 reboot

+------------- minute (0 - 59)
¦ +------------- hour (0 - 23)
¦ ¦ +------------- day of month (1 - 31)
¦ ¦ ¦ +------------- month (1 - 12)
¦ ¦ ¦ ¦ +------------- day of week (0 - 6) (Sunday to Saturday, 7 is also Sunday)
¦ ¦ ¦ ¦ ¦ +------------- some shell command
¦ ¦ ¦ ¦ ¦ ¦
¦ ¦ ¦ ¦ ¦ ¦
* * * * * reboot

(In this UDF the 6th field has no meaning and no influence on the result).
For more information see https://en.wikipedia.org/wiki/Cron


Finds the next event of the specified Cron expression, starting from current UTC/GMT.
_pce_findNextTimeUTC($sCronExp [, $bForwardSearch = True [, $minutesOffset = 0]]])

Finds the next event of the specified Cron expression. If $sDateTime is not set, local time will be used.
_pce_findNextTime($sCronExp [, $bForwardSearch = True [, $sDateTime = "" [, $minutesOffset = 0]]])

Convert names in usable Cron expression values. e.g. "15-30 2,3,4,5 29 July-December Mo-Su" to "15-30 2,3,4,5 29 7-12 1-7"
_pce_convertNames( $sCronExp )

See the include for details.

New version on GitHub: https://github.com/seizu/CronToTime

 

 

Edited by ergo
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...