Search code examples
phplaraveljobsphp-carbon

Laravel jobs delay at exact time


I tried to specify the exact time to process the job task in laravel:

$date = "2021-11-09 12:34:00";
$date = Carbon::parse($date)->timestamp;
JobsPublishArticle::dispatch()->delay($date);

the dd($date) give 1636461240 but in my jobs table i got 3272918981; It's like it added my date to the timestamp gived by now()


Solution

  • Try this:

    $date = "2021-11-09 12:34:00";
    $carbonDate = Carbon::parse($date);
    JobsPublishArticle::dispatch()->delay($carbonDate);