RandomPersonThingy Posted January 20, 2013 Share Posted January 20, 2013 Hello. I would like to program a script that lets you do something, only after 24 hours since you last did that. But, how can i do it? Quote Link to comment https://forums.phpfreaks.com/topic/273402-check-if-24-hours-have-passed/ Share on other sites More sharing options...
requinix Posted January 20, 2013 Share Posted January 20, 2013 Keep track of the last time they did it and don't let them to it again if it's been within 24 hours. Yeah, I know, pretty obvious. What else are you expecting us to say? Quote Link to comment https://forums.phpfreaks.com/topic/273402-check-if-24-hours-have-passed/#findComment-1407171 Share on other sites More sharing options...
CoreDestroyer Posted January 21, 2013 Share Posted January 21, 2013 if(empty($logintimevariablething) >= 86400){ //stuff here } Quote Link to comment https://forums.phpfreaks.com/topic/273402-check-if-24-hours-have-passed/#findComment-1407201 Share on other sites More sharing options...
Christian F. Posted January 21, 2013 Share Posted January 21, 2013 I think you'll find this page quite useful: http://php.net/manual/en/datetime.formats.relative.php Use that together with the DateTime class, or date (), and you'll be golden. Though, I recommend the former as it's more future-proof. Quote Link to comment https://forums.phpfreaks.com/topic/273402-check-if-24-hours-have-passed/#findComment-1407234 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.