# Instead of the timer to register the date?

``````<?
\$seconds = time()-\$deposits['unixtime'];
\$seconds=(60*(\$depperiod))-\$seconds;
if(\$seconds<1){
if(\$deposits['status']==1){
\$deptime="Paid";}else{
\$deptime="Paid";
}
}else

{

\$hours = floor(\$seconds/3600);
\$seconds = \$seconds-(\$hours*3600);
\$minutes = floor(\$seconds/60);
\$seconds = \$seconds-(\$minutes*60);
\$seconds = floor(\$seconds);

\$h=\$hours;
if(\$h<10){\$h='0'.\$h;}
\$m=\$minutes;
if(\$m<10){\$m='0'.\$m;}
\$s=\$seconds;
if(\$s<10){\$s='0'.\$s;}
\$deptime=\$h.":".\$m.":".\$s;
}
?>
<td class="countdown"><?=\$deptime?></td>``````

now looks like this
but in the end it should look like
March 23rd 20 at 19:42
March 23rd 20 at 19:44
Solution
You have seconds?
\$seconds = time()-\$deposits['unixtime'];

And how many seconds in a day ? 86400
So if you share all your seconds 86400 (dropping everything after the decimal point) then . will receive a days. If it is lower than unit (type 0.4545) - write "less than one day"
Yes, the second is, I can not understand where and what to prescribe. In polocaine php :/

Just learning and such Zapara( - Jarrod29 commented on March 23rd 20 at 19:47
well, damn it ))
here is the function :
``````function getDays(\$seconds){

\$tmp =\$seconds/86400;
if(\$tmp < 1)
return 'less than one day!';
\$days = (int)\$tmp;
\$ending =
(in_array(
substr((string)\$days, -1),
['4','3','2'])) ? 'I' : 'her'; // we need to take into account the end - they are of two kinds!
return "left {\$days} days{\$ending}";
}``````

``````//This f-tsiya
function getDays(\$seconds){
\$tmp =\$seconds/86400;
if(\$tmp < 1)
return 'less than one day!';
\$days = (int)\$tmp;
\$ending =
(in_array(
substr((string)\$days, -1),
['4','3','2'])) ? 'I' : 'her';
return "left {\$days} days{\$ending}";
}

// everything else
\$seconds = time()-\$deposits['unixtime'];
\$days = getDays(\$seconds);
echo "<td class='countdown'>{\$days}</td>";``````

but I wrote it on the knee , so that may have to be finished!
well it would have to write code for situations when the input is not what we need ) - Madilyn_Cummings commented on March 23rd 20 at 19:50
Thank you! - Jarrod29 commented on March 23rd 20 at 19:53
@Jarrod29, most importantly, to understand :) - Madilyn_Cummings commented on March 23rd 20 at 19:56
March 23rd 20 at 19:46
Do by analogy with what is already there + the desired function of the declination of nouns
``````<?php
tpl_tpluralForm function(\$n, \$form1, \$form2, \$form3)
{
\$n = abs(\$n) % 100;
\$n1 = \$n % 10;

if (\$n > 10 && \$n < 20) {
return \$form3;
}

if (\$n1 > 1 && \$n1 < 5) {
return \$form2;
}

if (\$n1 == 1) {
return \$form1;
}

return \$form3;
}

\$seconds = 2*24*60*60 + 8*60*60;

\$days = floor( \$seconds / (24*60*60) );
\$hours = \$seconds < 24*60*60
? floor( \$seconds / (60*60) )
: floor( (\$seconds % (24*60*60)) / (60*60) )
;
echo \$days.' '.tpl_tpluralForm(\$days, 'day', 'day', 'days')
.' '.\$hours.' '.tpl_tpluralForm(\$hours, 'hour', 'hours', 'hours');``````

Prints: 2 days 8 hours
March 23rd 20 at 19:48
``````use Carbon\Carbon;
....
\$now = Carbon::now();

\$now->diffForHumans(); // 5 seconds ago

\$now->toDateTimeString(); // 2019-06-13 20:27:10``````

Find more questions by tags PHP