https://github.com/romansky/scron
Scala cron parser
https://github.com/romansky/scron
Last synced: about 1 month ago
JSON representation
Scala cron parser
- Host: GitHub
- URL: https://github.com/romansky/scron
- Owner: romansky
- License: mit
- Created: 2014-06-14T13:27:01.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2024-01-02T12:20:35.000Z (over 2 years ago)
- Last Synced: 2025-01-10T05:36:43.973Z (over 1 year ago)
- Language: Scala
- Size: 17.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
scron [](https://travis-ci.org/uniformlyrandom/scron)
=================
Cron format to time parsing implemented in scala
## Usage
```scala
import com.uniformlyrandom.scron.Scron
val startTime = DateTime.now.getMillis
val endTime = startTime + ( 60 * 60 )
val times = Scron.parse("* * * * * *", startTime, endTime)
// times is now filled with epoch time for every second for the next hour
times.length == 60 * 60
```
## Supported Cron Formatting
### General Format
* * * * * *
| | | | | |day of week(0-6)
| | | | |month(1-12)
| | | |day of month(1-31)
| | |hour(0-23)
| |minute(0-59)
|seconds(0-59)
See [WikiPedia](http://en.wikipedia.org/wiki/Cron) for more information about the format
### Supported Formatting Of Specific Fields
* `*` all the options for that field
* `*/2` starting from the first option, every other option
* `0` only use the explicitly provided option
* `2,4,9` use list of values provided, separated by comma
## Installation
Using sbt, add to `build.sbt`
libraryDependencies ++= Seq(
"com.uniformlyrandom" %% "scron" % "1.0.0"
)