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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:00:34+00:00 2026-05-24T05:00:34+00:00

This is really strange. I have two time values. First time: $t1 = 1311165885;

  • 0

This is really strange. I have two time values.

First time:

$t1 = 1311165885;

Second time (which is bigger than the first time):

$t2 = 1312049530;

I am going to subtract the times like this:

$diff = $t2-$t1;

When I do an echo $diff this is coming out:

echo 'Time_diff: ' . $diff; 
Time_diff: -1311163874

The actual result should be 883645. What is wrong?

Thanks in advance!

Craphunter

Then here is my code:

<?php 
$current_time = DataConverter::makeDatetime();

foreach ($order as $list) {
    echo '-----------'.'</br>';
    $create_unix_time = DataConverter::makeTimestamp($list->getCreate());
    $diff = $current_time-$create_unix_time;

    if ($diff >= 864000) {
        echo 'aus db: ' .  $list->getErstellt() . '</br>';
        echo $list->getId() . '</br>';
        echo 'old';
    }
    else {
    }
}

?>
  • 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-24T05:00:35+00:00Added an answer on May 24, 2026 at 5:00 am
    <?php
    
    $t1 = 1311165885;
    $t2 = 1312049530;
    $diff = $t2-$t1;
    
    echo 'Time 1: ' . date('Y-m-d H:i:s', $t1) . PHP_EOL;
    echo 'Tim2 2: ' . date('Y-m-d H:i:s', $t2) . PHP_EOL;
    echo 'Time diff: ' . $diff . PHP_EOL;
    

    … prints this:

    Time 1: 2011-07-20 14:44:45
    Tim2 2: 2011-07-30 20:12:10
    Time diff: 883645
    

    What you say you are getting does look like a regular timestamp rather than a diff:

    echo date('Y-m-d H:i:s', 1311163874) . PHP_EOL;
    

    … prints:

    2011-07-20 14:11:14
    

    There’s probably a mistyped variable name somewhere in your code.

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

Sidebar

Related Questions

I have this really strange problem where my entity framework query isn't enumerating correctly.
This is a really strange issue. I have developed a small MVC application and
This is really strange but this code is working fine unless the value entered
This is a really strange issue. One day my project started to do a
This is a really strange problem, that appears to be somewhat intermittent (although it
(this is regarding the Ramaze.net framework) I ran into some really strange problems while
This is a really strange behavior, and I've set up some demo code to
This is a really strange issue. When using WebClient.DownloadFile in Debug configuration, it appears
I've come across a really strange problem. I have written a simple Deck class
I have a bit of strange problem on this page: http://www.bluprintliving.com/locations it seems that

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.