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? 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? 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 } 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. 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
Archived
This topic is now archived and is closed to further replies.