PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Mon Jan 31, 2005 8:57 am
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]
Last edited by
Dale on Mon Jan 31, 2005 10:05 am, edited 1 time in total.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Jan 31, 2005 9:04 am
It is always better to use unix time stamps as they are more portable for a variety of thigns, as you can see
... Just use the date function now to display it according.
Last edited by
John Cartwright on Mon Jan 31, 2005 9:05 am, edited 1 time in total.
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Mon Jan 31, 2005 9:05 am
So i dont have to add the "s" ?
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Mon Jan 31, 2005 9:07 am
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.
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Mon Jan 31, 2005 9:08 am
Ohhh... I get it
Thanks!
hunterhp
Forum Commoner
Posts: 46 Joined: Sat Jan 22, 2005 5:20 pm
Contact:
Post
by hunterhp » Mon Jan 31, 2005 9:48 am
Dale wrote: Ohhh... I get it
Thanks!
How come you didn't follow your own sig's advice?
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Mon Jan 31, 2005 10:04 am
hunterhp wrote: Dale wrote: Ohhh... I get it
Thanks!
How come you didn't follow your own sig's advice?
tags dont work anymore...
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Mon Jan 31, 2005 10:16 am
ok, question 2... how do i change the time(); value (eg; 1107186914) to a date(); value? (eg; h:i:s)
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Mon Jan 31, 2005 11:02 am
Code: Select all
echo date("F j, Y, g:i a", $value)Code: Select all
http://uk.php.net/manual/en/function.date.php