Jump to content

How to remake checking in months?


orbipwn

Recommended Posts

Hi,

how can i make that code to check in months and years (both) or month or year separately? Thanks.

<div class="custom">
 {{$date_joined = floor((strtotime("now")-strtotime("{$comment->author()->joined}"))/86400) ;}}  
<span class="leftinfo"><i class="fa fa-calendar"></i> $time of fappig:</span>
<span class="rightinfo">{$date_joined} Days</span>
</div>              

 

Link to comment
Share on other sites

Something like

$ct = DateTime::createFromFormat('U', time());
$jt = DateTime::createFromFormat('U', $comment->author()->joined);
$delta = $jt->diff($ct);
$years = $delta->format('%y'); 
$month = $delta->format('%m');
echo "Fapping with us {$years} year and {$month} months";

Link to comment
Share on other sites

Good, but i got an error.

[[Template forums/front/topics/postContainer is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Link to comment
Share on other sites

{{$ct=\DateTime::createFromFormat('U',\time());$jt=\DateTime::createFromFormat('U',$comment->author()->joined);$delta=$jt->diff($ct);$years=$delta->format('%y');$month=$delta->format('%m');}}

<div class="custom">
<span class="leftinfo"><i class="fa fa-calendar"></i>Fapping with us</span> 
<span class="rightinfo">{$years} year and {$month} months</span>
</div> 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Ваша ссылка была автоматически строена.   Отображать как обычную ссылку

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...