eyalrosen123rulezz Posted February 6, 2008 Share Posted February 6, 2008 Hello! What's up? How can i know if 30 minutes has been passed since a specific date and time (like 2008-02-06 14:33:11)? Many thanks! Eyal Link to comment https://forums.phpfreaks.com/topic/89709-have-30-minutes-passed-since-a-specifc-time-and-date/ Share on other sites More sharing options...
haku Posted February 6, 2008 Share Posted February 6, 2008 Convert the time/date into a unix timestamp using mktime(), then use this code: if(time() > (earlierTime + (60*30))) { echo "More than 30 minutes has passed"; } else { echo "thirty minutes hasn't yet passed"; } Where 'earlierTime' is the time you created using mktime(). note: time() will give you the unix timestamp for the current time. Link to comment https://forums.phpfreaks.com/topic/89709-have-30-minutes-passed-since-a-specifc-time-and-date/#findComment-459695 Share on other sites More sharing options...
eyalrosen123rulezz Posted February 6, 2008 Author Share Posted February 6, 2008 Great! Thanks! And how can I know how many minutes have been passed? Eyal Link to comment https://forums.phpfreaks.com/topic/89709-have-30-minutes-passed-since-a-specifc-time-and-date/#findComment-459798 Share on other sites More sharing options...
schilly Posted February 6, 2008 Share Posted February 6, 2008 (time() - earliertime) / 60. might need to round it as well. Link to comment https://forums.phpfreaks.com/topic/89709-have-30-minutes-passed-since-a-specifc-time-and-date/#findComment-459842 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.