Jump to content

Recommended Posts

Hello,

 

I am comparing these 2 time stamps to see how much time has passed. They time passed is 66 seconds.

 

When I format them back into h:m:s, it shows 1 hour, 1 minute and 6 seconds instead of just 1 minute and 6 seconds.

 

I was just wondering why this was?

 

Thanks

$startStamp = 1487156507;
$endStamp = 1487156573;
$howLong = $endStamp - $startStamp;
echo $howLong . "<br>";
echo(date("h:m:s",$howLong)) . "<br>";

The date() function operates on Unix timestamps. Passing 66 to it means 1970-1-1 00:00:66 UTC. How this is displayed depends on the time zone.

 

If you want an interval like 66 seconds, you need to actually create an interval and format that. 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.