By John Koster
The today helper function is similar to the now helper function in that it returns a Carbon for the current date, however, the difference is that the today helper function only returns the date component; the time component is set to 00:00:00.
The today function also accepts an optional timezone parameter to adjust the timezone of the returned Carbon instance.
#Signature
The signature of the today function is:
1function today(
2 $tz = null
3);
#Example Use
The following example demonstrates the usage of the today helper function to get the current date:
1// Get the current day of the year.
2$dayOfYear = today()->dayOfYear;
3
4// Supply a timezone and get the day of the week.
5$dayOfWeek = today('Europe/London')->dayOfWeek;
∎