Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-23-2005, 10:09 PM   #1
Dusen
Confirmed User
 
Join Date: Aug 2002
Location: East Coast.
Posts: 2,251
Help With PHP and timestamp

I set this up:

$time1=time();

Later On,

$time2=time();

if I:

echo $time1 -> 1109145600
echo $time2 -> 1109201240

But if I

echo($time2 - $time1) -> -1109145600

Why? Why is it not 55640?

Can Anyone help?
__________________
Penis Pill Sponsor List and Reviews:
http://www.pillsponsors.com
Dusen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-23-2005, 10:16 PM   #2
azguy
Confirmed User
 
Join Date: Nov 2004
Location: Scottsdale, AZ
Posts: 5,167
Can't be.

But try echo((int)$time2 - (int)$time1);
azguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-23-2005, 10:30 PM   #3
MikeXAMO
Confirmed User
 
Join Date: Mar 2002
Location: Trailer Park
Posts: 660
you sure your echo statement is exactly as shown? It should print 55640, unless you misspelled your variable, or maybe forgot to put brackets around your math statement.

Try doing:

Code:
$time1=time();
$time2=time();
$result=$time2-$time1;
echo $result;
That should guarantee you the result you want. You shouldn't have to use typecasting (int) if you assigned your variables using the time() function, it will return an integer.
__________________
Xamo Entertainment
Xamo.com | EZSets.com

ICQ: 9439118 MSN: mikeb [at] xamo.com Tollfree: 800-544-XAMO
XXX CMS - Designed by Adult Webmasters, for Adult Webmasters.
MikeXAMO is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-23-2005, 10:30 PM   #4
richard
Confirmed User
 
Join Date: Feb 2001
Location: UK
Posts: 543
My guess is that you've made a type on the echo?

ie PHP is calculating "0-$time1"
__________________
richard is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-23-2005, 10:30 PM   #5
MikeXAMO
Confirmed User
 
Join Date: Mar 2002
Location: Trailer Park
Posts: 660
by the way, if you are timing your application, use microtime() as it is more precise (milliseconds).
__________________
Xamo Entertainment
Xamo.com | EZSets.com

ICQ: 9439118 MSN: mikeb [at] xamo.com Tollfree: 800-544-XAMO
XXX CMS - Designed by Adult Webmasters, for Adult Webmasters.
MikeXAMO is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-23-2005, 10:42 PM   #6
Dusen
Confirmed User
 
Join Date: Aug 2002
Location: East Coast.
Posts: 2,251
Damn, I should be in bed. That's exactly what it was doing.

0-$time1

mistyped var.

Thanks for the help guys.
__________________
Penis Pill Sponsor List and Reviews:
http://www.pillsponsors.com
Dusen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-23-2005, 10:44 PM   #7
azguy
Confirmed User
 
Join Date: Nov 2004
Location: Scottsdale, AZ
Posts: 5,167
hehe
azguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.