How can I determine the day of the week when I use Carbon in Laravel? In addition, if {code...} has a Chinese document or tutorial of carbon, please give an address. The time is too small and it is too slow to read official documents. Thank you! How can I determine the day of the week when I use Carbon in Laravel?
In addition,
How to crop the results of Carbon: now () to a format like this: 20160628; how to convert a format like 20160628 to Carbon: now ()-> dayOfYear.
If you have a Chinese document or tutorial for carbon, please give it an address. it takes too little time to read official documents.
Thank you!
Reply content:
How can I determine the day of the week when I use Carbon in Laravel?
In addition,
How to crop the results of Carbon: now () to a format like this: 20160628; how to convert a format like 20160628 to Carbon: now ()-> dayOfYear.
If you have a Chinese document or tutorial for carbon, please give it an address. it takes too little time to read official documents.
Thank you!
The native PHP method is used.
Carbon is an external dependency package, you can take a look at this http://carbon.nesbot.com/docs/
$dt = Carbon::now()->dayOfWeek;// $dt = 0 ~ 6
Note: 0 is returned on Sunday.
echo (new Carbon('20160628'))->dayOfYear;
Carbon
It is very flexible. it is recommended to look at the source code in many ways