[advanced search]
Results from the most recent live auction are here.
21 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 01-21-2007, 03:17 AM   · #1
Davic
Account Closed
 
Trader Rating: (0)
Join Date: Nov 2006
Posts: 7
NP$: 0.00 (Donate)
Davic is an unknown quantity at this point
Php time help

Hi their,

I need a bit of help with a php time stamp script, basicly I need a script that gets a stored time from the database, and reads its and does 1 of two things,

If the time in the database in under 24 hours from this time it either echos come back after 24 hours or the exact time left, and if the time is over 24 hours it echo thanks ( I will change this bit latter)


I am not sure how to approach this so all help is appreciated

Thanks

Davic


Please register or log-in into NamePros to hide ads
Davic is offline   Reply With Quote
Old 01-21-2007, 05:25 AM   · #2
Matthew.
Stud Sausage
 
Location: England
Trader Rating: (25)
Join Date: Dec 2006
Posts: 1,545
NP$: 32.41 (Donate)
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
Adoption Breast Cancer Breast Cancer Cancer Survivorship
Assuming $time is your stored timestamp try something like:

PHP Code:
// $time = your stored timestamp

if(($time - time()) >= 86400)
{
    
// if timestamp minus current timestamp is greater than or equal to the number of seconds in 24 hours
    
echo 'Thanks!';
}
else
{
    echo
'Come back in ' . date('h \h\ou\r\s i \m\i\nu\t\e\s s \s\e\c\o\n\d\s', ($time - time()));
}


To try it out just make up a random timetamp like so:
PHP Code:
$time = time() - mt_rand(1, 86400);


(obviously that will change everytime the page loads but it's just to show it working)

Matt
__________________
My NamePros Tools
(firefox plugin, google gadget etc)

Last edited by Matthew. : 01-21-2007 at 05:30 AM.
Matthew. is offline   Reply With Quote
Old 01-21-2007, 09:54 AM   · #3
Davic
Account Closed
 
Trader Rating: (0)
Join Date: Nov 2006
Posts: 7
NP$: 0.00 (Donate)
Davic is an unknown quantity at this point
Thanks for that works a wonder, obviously if I change >= <= that would do the same just about the oppsite way correct?
Davic is offline   Reply With Quote
Old 01-21-2007, 10:00 AM   · #4
Matthew.
Stud Sausage
 
Location: England
Trader Rating: (25)
Join Date: Dec 2006
Posts: 1,545
NP$: 32.41 (Donate)
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
Adoption Breast Cancer Breast Cancer Cancer Survivorship
Originally Posted by Davic
Thanks for that works a wonder, obviously if I change >= <= that would do the same just about the oppsite way correct?



Yes, although if you used <= instead of just < then for the 1 second where timestamps are exact, it would give you the opposite output than what you want. (but that would only be for 1 second)
__________________
My NamePros Tools
(firefox plugin, google gadget etc)
Matthew. is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Buy Flash Arcade Game Script Website Header Design Proof is in the Parking
Advertise your business at NamePros
All times are GMT -7. The time now is 10:44 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0