@@ -286,14 +286,37 @@ defined by PHP datetime functions::
286
286
RecurringMessage::every('3 weeks', new Message());
287
287
RecurringMessage::every('first Monday of next month', new Message());
288
288
289
- $from = new \DateTimeImmutable('13:47', new \DateTimeZone('Europe/Paris'));
290
- $until = '2023-06-12';
291
- RecurringMessage::every('first Monday of next month', new Message(), $from, $until);
292
-
293
289
.. tip ::
294
290
295
291
You can also define periodic tasks using :ref: `the AsPeriodicTask attribute <scheduler-attributes-periodic-task >`.
296
292
293
+ Be aware that the message isn't passed to the messenger when you start the
294
+ scheduler. The message will only be executed after the first frequency period
295
+ has passed.
296
+
297
+ It's also possible to pass a from and until time for your schedule. For
298
+ example, if you want to execute a command every day at 13:00::
299
+
300
+ $from = new \DateTimeImmutable('13:00', new \DateTimeZone('Europe/Paris'));
301
+ RecurringMessage::every('1 day', new Message(), from: $from);
302
+
303
+ Or if you want to execute a message every day until a specific date::
304
+
305
+ $until = '2023-06-12';
306
+ RecurringMessage::every('1 day', new Message(), until: $until);
307
+
308
+ And you can even combine the from and until parameters for more granular
309
+ control::
310
+
311
+ $from = new \DateTimeImmutable('2023-01-01 13:47', new \DateTimeZone('Europe/Paris'));
312
+ $until = '2023-06-12';
313
+ RecurringMessage::every('first Monday of next month', new Message(), from: $from, until: $until);
314
+
315
+ If you don't pass a from parameter to your schedule, the first frequency period
316
+ is counted from the moment the scheduler is started. So if you start your
317
+ scheduler at 8:33 and the message is scheduled to perform every hour, it
318
+ will be executed at 9:33, 10:33, 11:33 and so on.
319
+
297
320
Custom Triggers
298
321
~~~~~~~~~~~~~~~
299
322
0 commit comments