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 830411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:02:21+00:00 2026-05-15T04:02:21+00:00

Hello in my database date / time are in this format 2010-06-01T18:20:25+0000 I’d like

  • 0

Hello in my database date / time are in this format

2010-06-01T18:20:25+0000

I’d like to echo that out to time passed since that date / time

e.g.

4 days 3 hours 36 minutes and 4 seconds

is this possible?

  • 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-15T04:02:22+00:00Added an answer on May 15, 2026 at 4:02 am

    Below is a function I wrote to do this. Feel free to use it.

    /**
     * Returns rough (in largest single unit) time elapsed between two times.
     * @param int $iTime0  Initial time, as time_t.
     * @param int $iTime1  Final time, as time_t. 0=use current time.
     * @return string Time elapsed, like "5 minutes" or "3 days" or "1 month".
     *              You might print "ago" after this return if $iTime1 is now.
     * @author Dan Kamins - dos at axonchisel dot net
     */
    function ax_getRoughTimeElapsedAsText($iTime0, $iTime1 = 0)
    {
        if ($iTime1 == 0) { $iTime1 = time(); }
        $iTimeElapsed = $iTime1 - $iTime0;
    
        if ($iTimeElapsed < (60)) {
            $iNum = intval($iTimeElapsed); $sUnit = "second";
        } else if ($iTimeElapsed < (60*60)) {
            $iNum = intval($iTimeElapsed / 60); $sUnit = "minute";
        } else if ($iTimeElapsed < (24*60*60)) {
            $iNum = intval($iTimeElapsed / (60*60)); $sUnit = "hour";
        } else if ($iTimeElapsed < (30*24*60*60)) {
            $iNum = intval($iTimeElapsed / (24*60*60)); $sUnit = "day";
        } else if ($iTimeElapsed < (365*24*60*60)) {
            $iNum = intval($iTimeElapsed / (30*24*60*60)); $sUnit = "month";
        } else {
            $iNum = intval($iTimeElapsed / (365*24*60*60)); $sUnit = "year";
        }
    
        return $iNum . " " . $sUnit . (($iNum != 1) ? "s" : "");
    }
    

    To use this func, you’d need to first convert your times to time_t format (integer #seconds since the “epoch”). Either of these PHP functions will probably help with that: http://php.net/strptime or http://php.net/strtotime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sending data in database Like Hello fnds, How are you. I am
Hello I`ve created simple WFC DataService and connected entit model with my database. This
Hello i want to send to a MySQL data base a date and time
Hello I have a mysql database with in it an addresses table. This is
Hello I want to query a MySQL database in a date range for last
hello friends I am newbie to Yii.I have the date and time in mysql
Hello there I have a database that has 2 tables in it, one is
hello i am trying a sqlite database tutorial to build, but its not working
Hello i have a question on picking random entries from a database. I have
Hello, i'm trying to take detailed information from the database, i create a simple

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.