Jump to content

Recommended Posts

ok so lets say, in my database is set a time in unix, in the future. lets say + 2 days from now.

 

i want to display some output that would say:

 

2 days, 0 hours and 0 minutes remaining.

 

obviously this would grab the current time() and compare it to the value in the database....

but how do i go about even making something that can do this?

 

<?php
$newTime = time()+3600*24*2; // todays from now.
$timeLeft = $newTime - time();

echo date('d', $timeLeft) . " days left";
?>

 

That probably will not get you the exact results but it is a start.

 

You may want to look into strtotime also.

Yer both values are going to have to be inputted through as unix thou. Since its like a que timer, I want ny users to know how long they have left to wait.

 

I considered using java script here but it won't be nessasary reallly + its always better to use as little variations of coding type as possible.

 

I've checked up on the google for some infos about php count down but none seem to use unix other than time() feature which is an obvious requirement since u are comparing whatever value to this.

 

Is ther a way to convert time() to say something like Date(0,0,0,0,0) just with numbers?

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.