Page 1 of 1

Make date("s"); 30 in the future?

Posted: Mon Jan 31, 2005 8:57 am
by Dale
I do this

Code: Select all

<?php
$a1 = date("s");
$b2 = 30;
$c3 = $a1 + $b2;
print $c3;
?>
However when its 56 seconds past the minute the future seconds ($c3) shows 86... but i want it to show it as 26... please help :)

tags don't work :([/b]

Posted: Mon Jan 31, 2005 9:04 am
by John Cartwright

Code: Select all

$newtime = time() + 30;
It is always better to use unix time stamps as they are more portable for a variety of thigns, as you can see :P... Just use the date function now to display it according.

Posted: Mon Jan 31, 2005 9:05 am
by Dale
So i dont have to add the "s" ?

Posted: Mon Jan 31, 2005 9:07 am
by John Cartwright
I'm a bit confused on what your saying, notice in my example I use the
time() function and you used to the date() function to get the time.
Read my previous post as I updated it.

Posted: Mon Jan 31, 2005 9:08 am
by Dale
Ohhh... I get it :)

Thanks!

Posted: Mon Jan 31, 2005 9:48 am
by hunterhp
Dale wrote:Ohhh... I get it :)

Thanks!
How come you didn't follow your own sig's advice?

Posted: Mon Jan 31, 2005 10:04 am
by Dale
hunterhp wrote:
Dale wrote:Ohhh... I get it :)

Thanks!
How come you didn't follow your own sig's advice?
tags dont work anymore...

Posted: Mon Jan 31, 2005 10:16 am
by Dale
ok, question 2... how do i change the time(); value (eg; 1107186914) to a date(); value? (eg; h:i:s)

Posted: Mon Jan 31, 2005 11:02 am
by JayBird

Code: Select all

echo date("F j, Y, g:i a", $value)

Code: Select all

http://uk.php.net/manual/en/function.date.php