How can i split datetime into different parts?
<p>I have a column in my database named <code>created_at</code> (I am using laravel 5.2).Its value is something like this: <code>2016-10-01 01:22:13</code> .I want to split this date time in Year,Month,Day,Hour,Minute,Second.</p>

<p>I can go with below approach for just date have <code>2016-10-01</code> :</p>

<pre><code>$resDate= explode('-', $resDate);
$year  = $resDate[0];
$month = $resDate[1];
$day   = $resDate[2];
</code></pre>

<p>But if date and time is altogether (<code>2016-10-01 01:22:13</code>) then how can i split it? </p>