Home > Back-end >  Laravel specify any date
Laravel specify any date

Time:08-05

Is there any way where I can set any date I wanted in Laravel. I have to demonstrate a testing and I need to check if the code works for different date. I want to specify the date in my Laravel project to ensure that the code runs in the specify date. I search a lot of question and non of it answered my question most of the question are on how to change the date format.

CodePudding user response:

Carbon - Testing Aids: https://carbon.nesbot.com/docs/#api-testing

Allows you to mock the time in tests with Carbon::setTestNow()

And see Carbonite for more advanced features: https://github.com/kylekatarnls/carbonite

CodePudding user response:

Ok so you want to run some function on specific date/time, which you will set, for this you have to put CRON for that function and you have to specify there a date/time in laravel.

  • Related