Jump to content

matt0268

New Members
  • Posts

    6
  • Joined

  • Last visited

matt0268's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Doing some bitmasking, how do i store this in a variable/temp variable? $val = 128; $places = $_GET['action']; $res = $val >> $places; p($res, $val, '>>', $places); function p($res, $val, $places, $note = '') { $format = '%0' . (PHP_INT_SIZE * 1) . "b\n"; printf($format, $res); }
  2. <?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?
  3. Also represent the time in the form of e.g Sat Oct 6 08:17:56 2012
  4. Currently i have $today = time(); How can i make it the webhost server time? or make it set to est time? I don't want it like time(); - 32000 as people in germany it would be different for example. How can i set it to like $today = esttime or somthing
  5. Thanks for the response, i'm confused on how i can get the strftime from both dates? I'm using an API to get the date from one. If you could help me out i would appreciate it!
  6. <?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 = $json_array[0]['up_time']; $today = date("D M j d:i:s Y"); $uptime1 = ($today - $uptime); printf('Online'); printf ($uptime1); print "<br>"; print "date <--- "; printf ($today); print "<br>"; print "uptime <--- "; printf ($uptime); } else { printf('Offline'); } ?> It displays like this Online0 date <--- Sat Oct 6 06:34:51 2012 uptime <--- Sat Oct 6 06:15:44 2012 Problem is it doesn't subtract is just displays 0 Anyhelp?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.