Formatting the date and time that returns from created_at


I’ve been trying to display the status created_at time in users local time through the below API.

$content = $connection->get(‘statuses/home_timeline’, array(‘count’ => 14));

Response (for readability i posted 2 fields from each result) :

[created_at] => Sun Dec 14 04:58:58 +0000 2014
[utc_offset] => 19800

[created_at] => Sun Dec 14 04:58:11 +0000 2014
[utc_offset] => -28800

[created_at] => Sun Dec 14 04:57:56 +0000 2014
[utc_offset] => 

In the above response, you can see in a result utc_offset is empty. So,

  1. How should i get the current local time of user?
  2. What’s the default timezone that we receive in created_at?
  3. How to convert the Twitter generated TimeDate to local users timezone?

Through my research,
i found that we can obtain the current users local time by

  • Diving the utc_offset by 3600.
  • Then adding those value to the created_at time.

But, what if in case if utc_offset field is empty?