Skip to content

Instantly share code, notes, and snippets.

View reinforchu's full-sized avatar
🏠
Working from home

りいんちゃん reinforchu

🏠
Working from home
View GitHub Profile
@reinforchu
reinforchu / convertLocalTime
Created October 14, 2012 06:45
This is a function to convert local time to time format for twitter API.
/**
* Convert local time to time format for twitter API.
*
* @param timeStamp Time format for twitter API.
* @return Local time. Depends on the regional settings of the server and time.
*/
public static function convertLocalTime($timeStamp) {
if (isset($timeStamp) === FALSE) return FALSE;
sscanf($timeStamp, "%s %s %d %s %s %d", $week, $month, $day, $time, $gmt, $year);
$rcf2822 = "{$week}\054\040{$day}\040{$month}\040{$year}\040{$time}\040{$gmt}";