Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6674301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:43:44+00:00 2026-05-26T03:43:44+00:00

//Example data $current_time = 1318075950; $unbanned_time = $current_time + strtotime(‘+1 minute’); if ($unbanned_time >

  • 0
//Example data
$current_time = 1318075950;
$unbanned_time = $current_time + strtotime('+1 minute');


if ($unbanned_time > $current_time) {
  $th1is = date('Y-m-d H:i:s', $unbanned_time) - date('Y-m-d H:i:s', $current_time);
   echo date('Y-m-d H:i:s', $th1is);

I am trying to output how long time it is until the user is unbanned… year months, days, hours, minutes and seconds… But this is giving me some weird results..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:43:45+00:00Added an answer on May 26, 2026 at 3:43 am

    I would recommend to use DateTime

    $DateTime = new DateTime();
    $unbanned_DateTime = new DateTime();
    $unbanned_DateTime = $unbanned_DateTime->modify('+1 minute');
    
    if ( $unbanned_DateTime > $DateTime ) {
        $interval = $DateTime->diff($unbanned_DateTime);
        $years = $interval->format('%y'); 
        $months = $interval->format('%m'); 
        $days = $interval->format('%d'); 
        $hours = $interval->format('%h'); 
        $minutes = $interval->format('%i'); 
        $seconds = $interval->format('%s');
    }
    

    Instead of using every single value as variable you can use ->format() for one output. As you like.

    Remember DateTime->format() needs a timezone setting up in your php.ini or with

    date_default_timezone_set('....');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is some example data: data = data.frame(series = c(1a, 1b, 1e), reading =
Given the following example data: Users +--------------------------------------------------+ | ID | First Name | Last
I have following structure with example data: id season_id title 1 1 Intro 2
How can you sort the following word by the given rule? Example data is
ex: <a><strike>example data in here</strike></a> I want everything inside the a tag, to the
The Java data type byte for example holds data from -128 to 127 in
How to union data in ArrayList C# in dotnet framework 2? example of data
can any body help me on separating this example of data that i need
For example is MyLibrary.Data.Import.Hotels Bad Vs MyLibrary.Data.Import.ImportHotels Or even MyLibrary.Data.ImportHotels
I'm looking for a good example of storing data in a cookie using ASP.NET.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.