Using Carbon in Laravel, how to determine what day of the week today is?
Also,
<code>如何将Carbon::now()得到的结果裁剪成类似这样的格式:20160628; 如何将20160628这样的格式转成Carbon::now()->dayOfYear. </code>
If there is a Chinese document or tutorial on carbon, please give an address. There is too little time and it is too slow to read the official document.
Thank you!
Using Carbon in Laravel, how to determine what day of the week today is?
Also,
<code>如何将Carbon::now()得到的结果裁剪成类似这样的格式:20160628; 如何将20160628这样的格式转成Carbon::now()->dayOfYear. </code>
If there is a Chinese document or tutorial on carbon, please give an address. There is too little time and it is too slow to read the official document.
Thank you!
Using PHP native method.
carbon is an external dependency package, you can take a look at this http://carbon.nesbot.com/docs/
<code>$dt = Carbon::now()->dayOfWeek; // $dt = 0 ~ 6</code>
Note: Sunday returns 0
<code>echo (new Carbon('20160628'))->dayOfYear;</code>
Carbon
is very flexible. It is recommended to look at the source code. There are many, many methods