![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Nov 2004
Location: Scottsdale, AZ
Posts: 5,167
|
Can't be.
But try echo((int)$time2 - (int)$time1); |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
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;
__________________
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
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"
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Nov 2004
Location: Scottsdale, AZ
Posts: 5,167
|
hehe
![]() ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |