<p>Not really, and it'd be pretty difficult for PHP to truly emulate a cron service since, by nature, it requires something to execute it before it can run (in Craft's case, a browser request).</p>

<p>The closest thing in Craft would be its "Tasks" (completely undocumented).  Tasks are usually meant for things that might take a long time for PHP to complete and it's not critical that they happen right away.</p>

<p>But you can't schedule, them... if there is a task in a "pending" state in the craft_tasks table, the next request to the control panel is going to trigger it.</p>

<p>I suppose we could add something like a "runDate" property to tasks where you could be at least guaranteed they wouldn't run until the first control panel request was made after that given date.</p>

CC BY-SA 3.0
2014-07-14T16:37:01.157Z
2014-07-14T19:57:18.050Z
2014-07-14T19:57:18.050Z
Brad Bell
<p>Other than setting up a cron job, does Craft include any functionality for plugins to run a function at a specific time and/or date?</p>

<p>Some actions could include:</p>

<ul>
<li>Bulk activate/deactivate entries</li>
<li>Messaging all users every monday (or once a week)</li>
<li>Hitting an API (account update, eCommerce, data updating etc.)</li>
</ul>

<p>Let me know if a question like this already exists. I searched and couldn't find any related information.</p>

CC BY-SA 3.0
2014-07-14T16:43:26.357Z
Even I have managed to get [anonymous Controller actions](http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions) working as web hooks for cron. So while it may not be the answer you're looking for, it's pretty easy to get your Craft plugin to respond to requests.
Matt Stein
CC BY-SA 3.0
2014-07-14T17:23:07.877Z
Thanks @MattStein - I've used those too. Just looking to program something that fires off at a specific time every day/week.
Adam McCombs
<plugin-development><datetime><date>
Plugins: Time/Date specific functions
# Plugins: Time/Date specific functions

(Asked by: username_0 on 2014-07-14)

Other than setting up a cron job, does Craft include any functionality for plugins to run a function at a specific time and/or date?

Some actions could include:

* Bulk activate/deactivate entries
* Messaging all users every monday (or once a week)
* Hitting an API (account update, eCommerce, data updating etc.)

Let me know if a question like this already exists. I searched and couldn't find any related information.

**Tags:** plugin-development, datetime, date
> **Comments:**
> **username_1**: Even I have managed to get [anonymous Controller actions](http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions) working as web hooks for cron. So while it may not be the answer you're looking for, it's pretty easy to get your Craft plugin to respond to requests.  
> **username_0**: Thanks @MattStein - I've used those too. Just looking to program something that fires off at a specific time every day/week.  

---

## 1 answers

### Answer by username_2 on 2014-07-14. Score: 4 | Accepted answer

Not really, and it'd be pretty difficult for PHP to truly emulate a cron service since, by nature, it requires something to execute it before it can run (in Craft's case, a browser request).

The closest thing in Craft would be its "Tasks" (completely undocumented). Tasks are usually meant for things that might take a long time for PHP to complete and it's not critical that they happen right away.

But you can't schedule, them... if there is a task in a "pending" state in the craft\_tasks table, the next request to the control panel is going to trigger it.

I suppose we could add something like a "runDate" property to tasks where you could be at least guaranteed they wouldn't run until the first control panel request was made after that given date.


---

