matt0268 Posted October 6, 2012 Share Posted October 6, 2012 <?php $channel = "mattbenson"; $json_file = @file_get_contents("http://api.justin.tv/api/stream/list.json?channel={$channel}", 0, null, null); $json_array = json_decode($json_file, true); if( array_key_exists( '0', $json_array ) && array_key_exists( 'channel', $json_array[0] ) && $json_array[0]['name'] == "live_user_{$channel}" ) { $channelTitle = $json_array[0]['channel']['title']; $title = $json_array[0]['channel']['status']; $viewers = $json_array[0]['channel_count']; $uptime = strtotime($json_array[0]['up_time']); date_default_timezone_set("America/New_York"); $today = time(); $uptime1 = ($today - $uptime); printf('Online'); printf ($uptime1); print "<br>"; print "date <--- "; printf ($today); print "<br>"; print "uptime <--- "; printf ($uptime); } else { printf('Offline'); } ?> This is my code, but the date_default_timezone_set("America/New_York"); isn't working... Basically now it's taking away from the current time the PC is set to. I want it to be taken away from New York time, how can i get this to work? Link to comment https://forums.phpfreaks.com/topic/269168-date_default_timezone_set-function/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.