I'm trying to convert time stamp received from youtube api video feed.
the received time stamp is 2013-01-11T06:45:52.000Z
. I think it is GMT time stamp(correct me if I'm wrong). I wrote a function to convert the time stamp to IST.
function formatTime($ydatetime) {
$timestamp = explode("T", $ydatetime);
$date = $timestamp[0];
$gmtime = substr($timestamp[1], 0, 8);
$gmtimestamp = $date . " " . $gmtime;
$datetime = new DateTime($gmtimestamp, new DateTimeZone('GMT'));
$datetime->setTimezone(new DateTimeZone('IST'));
return $datetime->format('Y-m-d H:i:s');
}
But it returns the time stamp as 2013-01-11 08:45:52
where the difference is 2 Hrs only.
The actual difference between GMT and IST is 5.30 Hrs. please somebody help me.