fridday Posted March 31, 2008 Share Posted March 31, 2008 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 More sharing options...
Orio Posted March 31, 2008 Share Posted March 31, 2008 "Y-m-d, H:m" Should be (probably) "Y-m-d, H:i" Orio. Link to comment https://forums.phpfreaks.com/topic/98867-help-me-or-date/#findComment-505881 Share on other sites More sharing options...
BlueSkyIS Posted March 31, 2008 Share Posted March 31, 2008 yes, m is Numeric representation of a month, with leading zeros. so, to answer the question: you. Link to comment https://forums.phpfreaks.com/topic/98867-help-me-or-date/#findComment-505883 Share on other sites More sharing options...
fridday Posted March 31, 2008 Author Share Posted March 31, 2008 ooooooops! of course!! THANKS!!!!!!!! You're my hero! Link to comment https://forums.phpfreaks.com/topic/98867-help-me-or-date/#findComment-505892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.