Carbon
The carbon
function provides access to the \Carbon\Carbon
class.
Returns: /Carbon/Carbon
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$time |
false |
string |
null |
A date/time string. |
$timezone |
false |
string |
Configured default timezone. |
A timezone string. |
Twig
{{ carbon().today() }} // 2016-06-24 00:00:00
{{ carbon('-1 day', config('app.timezone')) }} // "2016-08-17 15:05:26"
{{ carbon('-1 day', config('app.timezone')).diffInHours() }} // 24