Jump to content

help! me or date()?


fridday

Recommended Posts

I'm deleveloping a torrent site, but can't get the unix timestamp conversion right. Look at this, I have made it into a working piece of code so you can try it.

 

<?php
$torrent_data[0]["name"] = "torrent one";
$torrent_data[1]["name"] = "torrent two";
$torrent_data[2]["name"] = "torrent three";
$torrent_data[0]["unix_timestamp"] = 1206961055;
$torrent_data[1]["unix_timestamp"] = 1206957978;
$torrent_data[2]["unix_timestamp"] = 1206959500;
$i=0;
while ($i<3) {
   $torrent_name = $torrent_data[$i]["name"];
   $torrent_timestamp = $torrent_data[$i]["unix_timestamp"];
   $torrent_date = date("Y-m-d, H:m", $torrent_timestamp);
   print $torrent_name.", ";
   print $torrent_timestamp.", ";
   print $torrent_date."<br>";
   $i++;
   }
?>

 

 

the output is:

torrent one, 1206961055, 2008-03-31, 12:03

torrent two, 1206957978, 2008-03-31, 12:03

torrent three, 1206959500, 2008-03-31, 12:03

 

why?

 

(I posted at http://forums.devnetwork.net/viewtopic.php?f=1&t=80728, but no one solved it, so I'm trying here aswell...)

Link to comment
https://forums.phpfreaks.com/topic/98867-help-me-or-date/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.