By John Koster
The now
helper function will return a new Carbon
instance initialized to the current date and time. The now
function accepts an optional timezone parameter to adjust the timezone of the returned date.
#Signature
The signature of the now
function is:
1function now(
2 $tz = null
3);
#Example Use
The following example demonstrates the usage of the now
helper function.
1// Get the current Atom formatted date and time.
2$atomDateTime = now()->toAtomString();
3
4// Get the current date and time for America/Toronto.
5$americaToronto = now('America/Toronto');
∎