Date Time format method for standard time (laravel 5.3)
<p>Its my method to get created date from DB to show in a proper format</p>

<pre><code>function showDateTime($student_id, $datetime)
   {

    $time_zone_app = DB::table('students')-&gt;where('id', $student_id_id)-&gt;value('time_zone');
    $zone_data = explode(':', $time_zone_app);

    $time_zone['hours']   = $zone_data[0];
    $time_zone['minutes'] = $zone_data[1];

    $carbon = new Carbon\Carbon();
    $carbon-&gt;setDateTime(2012, 9, 25, 10, 26, 11);
    $carbon-&gt;addHours($time_zone_data[0]);
    $carbon-&gt;addHours($time_zone_data[1]);

    $datetime = $carbon-&gt;toFormattedDateString();
    return $datetime;

}
</code></pre>

<p>Above I have hard code time because i am not getting time as i want 
if i echo $carbon below <code>$carbon = new Carbon\Carbon();</code> It gives me time as </p>

<pre><code>2016-9-25 07:04:02
</code></pre>

<p>I want to convert this time to format <code>2016, 9, 25, 7, 4, 02</code> as </p>

<p>(year, month, day, hours, minutes, seconds)
and then want to pass it to setDateTime method above</p>

<p>Please help how can i do</p>