Skip to content

Commit

Permalink
Updating readme to remove todo list and fix example code
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Sep 6, 2011
1 parent f43f955 commit 648cdc2
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ Download [cron.phar](https://raw.github.com/mtdowling/cron-expression/master/bui

Usage
-----
```php
<?php

<?php
require_once '/path/to/cron.phar';

// Works with predefined scheduling definitions
require_once '/path/to/cron.phar';
$cron = Cron\CronExpression::factory('@daily');
$cron->isDue();
echo $cron->getNextRunDate()->format('Y-m-d H:i:s);
echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s);
// Works with predefined scheduling definitions
$cron = Cron\CronExpression::factory('@daily');
$cron->isDue();
echo $cron->getNextRunDate()->format('Y-m-d H:i:s');
echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s');

// Works with complex expressions
$cron = Cron\CronExpression::factory('3-59/15 2,6-12 */15 1 2-5');
echo $cron->getNextRunDate()->format('Y-m-d H:i:s);
// Works with complex expressions
$cron = Cron\CronExpression::factory('3-59/15 2,6-12 */15 1 2-5');
echo $cron->getNextRunDate()->format('Y-m-d H:i:s');

// Calculate a run date two iterations into the future
$cron = Cron\CronExpression::factory('@daily');
echo $cron->getNextRunDate(null, 2)->format('Y-m-d H:i:s);
// Calculate a run date two iterations into the future
$cron = Cron\CronExpression::factory('@daily');
echo $cron->getNextRunDate(null, 2)->format('Y-m-d H:i:s');

// Calculate a run date relative to a specific time
$cron = Cron\CronExpression::factory('@monthly');
echo $cron->getNextRunDate(strtotime('2010-01-12 00:00:00'))->format('Y-m-d H:i:s);
// Calculate a run date relative to a specific time
$cron = Cron\CronExpression::factory('@monthly');
echo $cron->getNextRunDate(strtotime('2010-01-12 00:00:00'))->format('Y-m-d H:i:s');
```

CRON Expressions
----------------
Expand All @@ -58,8 +60,3 @@ Requirements
- PHP 5.3+
- PHPUnit is required to run the unit tests
- Phing is required to build the phar file

TODO
----

1. Add code coverage for DayOfMonth and DayOfYear

0 comments on commit 648cdc2

Please sign in to comment.