Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[SOLVED] Change timestamp of torrents
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

Unknown User
2019-05-04 10:42:29
Instead of full date and hours id like it to be 1 hour ago, 1 day ago, 1week ago, etc,

Use get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"])) to change it to 1week ago, 1 month ago, etc.
2020-05-02 15:55:27
This is pretty cool. I didnt create this, just found it and tried it. Try this. Functions.php
add this function
///ELAPSED TIME SINCE TORRENT WAS UPLOADED
function get_time_elapsed($datetime, $full = false)
{
   $now = new DateTime;
   $ago = new DateTime($datetime);
   $diff = $now->diff($ago);
   $diff->w = floor($diff->d / 7);
   $diff->d -= $diff->w * 7;
   $string = array(
       'y' => 'year',
       'm' => 'month',
       'w' => 'week',
       'd' => 'day',
       'h' => 'hour',
       'i' => 'minute',
       's' => 'second',
   );
   foreach ($string as $k => &$v)
   {
       if ($diff->$k)
       {
           $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
       }
       else
       {
           unset($string[$k]);
    }
   }
   if (!$full) $string = array_slice($string, 0, 1);
   return $string ? implode(', ', $string) . ' ago' : 'just now';
}
///END ELAPSE TIME

find
            case 'added':
               print("<td class='ttable_col$x' align='center'>".date("n-d-Y g:i a", utc_to_tz_time($row['added']))."</td>");
           break;

change to (I keep old code commented out in case there is a need to revert back)
            case 'added':
           //    print("<td class='ttable_col$x' align='center'>".date("n-d-Y g:i a", utc_to_tz_time($row['added']))."</td>");
               print("<td class='ttable_col$x' align='center'>".get_time_elapsed($row['added'])."</td>");
           break;

[ATTACH type="full" alt="Capture.PNG"]5476[/ATTACH]
Capture.PNG
Capture.PNG

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-05-03 12:29:06
:) that screenshot looks really cool especially the IMDB and Trailer columns
Torrent Trader PDO/MVC 2021
Xampp Windows 10 21H1
Apache Version: Apache/2.4.48 (Win64)
Mysql Version: 10.4.20-MariaDB
PHP Version: 8.0.9
2020-05-03 14:10:47
thank you it works very well ? (y)
2020-05-04 07:01:16
I added this post a little while ago, its time_ago() - is this not stock in functions.php? It binds all those functions together. I use it across the board, its a big saver!


function time_ago($addtime) {
  $addtime = get_elapsed_time(sql_timestamp_to_unix_timestamp($addtime));
  return $addtime;
}


Usage:
echo time_ago($row["date"]);
2020-05-04 07:06:44
"MicroMonkey, post: 68459, member: 311":

This is pretty cool. I didnt create this, just found it and tried it. Try this. Functions.php
add this function
///ELAPSED TIME SINCE TORRENT WAS UPLOADED
function get_time_elapsed($datetime, $full = false)
{
   $now = new DateTime;
   $ago = new DateTime($datetime);
   $diff = $now->diff($ago);
   $diff->w = floor($diff->d / 7);
   $diff->d -= $diff->w * 7;
   $string = array(
       'y' => 'year',
       'm' => 'month',
       'w' => 'week',
       'd' => 'day',
       'h' => 'hour',
       'i' => 'minute',
       's' => 'second',
   );
   foreach ($string as $k => &$v)
   {
       if ($diff->$k)
       {
           $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
       }
       else
       {
           unset($string[$k]);
    }
   }
   if (!$full) $string = array_slice($string, 0, 1);
   return $string ? implode(', ', $string) . ' ago' : 'just now';
}
///END ELAPSE TIME

find
            case 'added':
               print("<td class='ttable_col$x' align='center'>".date("n-d-Y g:i a", utc_to_tz_time($row['added']))."</td>");
           break;

change to (I keep old code commented out in case there is a need to revert back)
            case 'added':
           //    print("<td class='ttable_col$x' align='center'>".date("n-d-Y g:i a", utc_to_tz_time($row['added']))."</td>");
               print("<td class='ttable_col$x' align='center'>".get_time_elapsed($row['added'])."</td>");
           break;

[ATTACH type="full" alt="Capture.PNG"]5476[/ATTACH]


You can add DOM events that allow a click on that IMBD image and present a small dynamic box or "theatre mode" to preview the trailer
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728