php - How to calculate unix timestamp in days/minutes/seconds? -


I found the script to compare the entrance date / time and the logout date / time, followed by these two values The difference between the median has been added to the balance sheet in the MSSQL 2005 table, for example: If the user is online a few seconds, it will add value of about 98 Unix timestamps for example. So how can that value be displayed on the website as a human reading: If possible, day / minute / second?

Thank you very much for checking my question.

  function slimmer () {$ db = $ this- & gt;}  

This is my rank script where I have to include:; Database [gdb]; $ Num_rows = $ db- & gt; doQuery ('SELECT TOP 100 ID, Name, data select data from SUM (CoolPoint) data. user = information. user and data.) from the information as authorized IN (1, 2)) where INFO.User does not (1199,16300) Points DESC by order;); If ($ num_rows == -1) {$ db-> getError (); Return; } $ N = 1; $ Content = ''; ($ Line = $ db-> doRead ()) {$ data = array ('rank-id' = & gt; $ row ['num'], 'rank-pos' => $ n ++ , 'Rank-name' = & gt; $ line ['name'], 'rank-number' = & gt; number-format (interval ($ line ['digits']))); $ Content = Template :: Load ('PointCrank-'. ($ N% 2 == 1? 2: 1), $ data); } $ This- & gt; Content = Template :: Load ('total_pointrank', array ('ranks' = & gt; $ content)); }

So, what I want to include above in my rank script is the best way, so I show the total user online time based on totaltime data table? I know how to get involved, but I am confused about how to convert it to human reading in this ceremony.

This should suit your needs:

  $ Timestamp_diff = 456; // Your Timestamp Difference Here Second Echo Second ($ Timestamp_Diff);   

and this function:

  function secondstimetime ($ sec) {// return day / hour / minute / second $ dtF = new date time ("@ 0 "); $ DtT = new date time ("@ $ sec"); Return $ dtF- & gt; Difference ($ dtT) - & gt; Format ('% a /% h /% i /% s'); }   

Based on

Edit: By putting it together with your existing script: (I think?)

  Function Thumbnail Dimension () {$ Db = $ this- & gt; Database [gdb]; $ Num_rows = $ db- & gt; doQuery ('SELECT TOP 100 ID, Name, data select data from SUM (CoolPoint) data. user = information. user and data.) from the information as authorized IN (1, 2)) where INFO.User does not (1199,16300) Points DESC by order;); If ($ num_rows == -1) {$ db-> getError (); Return; } $ N = 1; $ Content = ''; ($ Line = $ db-> doRead ()) {$ data = array ('rank-id' = & gt; $ row ['num'], 'rank-pos' => $ n ++ , 'Rank-name' = & gt; $ line ['name'], 'rank-points' => $ this-> secondstime time (interval ($ line ['digit']))); $ Content = Template :: Load ('PointCrank-'. ($ N% 2 == 1? 2: 1), $ data); } $ This- & gt; Content = Template :: Load ('total_pointrank', array ('ranks' = & gt; $ content)); } Function secondtimetime ($ sec) {// Return day / minute / second $ dtf = new date time ("@ 0"); $ DtT = new date time ("@ $ sec"); Return $ dtF- & gt; Difference ($ dtT) - & gt; Format ('% a /% i /% s'); }    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -