angelicaescobar Posted January 22, 2009 Share Posted January 22, 2009 Hello again!! I need your help.. I hope you can help me. this is my case: I hape a date that is in an array in this posistion: $bookings[$i-1][date("d.m.Y",$timestampOfMonday+($x*86400))]["daterequest"] and i want to compare it with the actual time, (unixtime) and if it is bigger than one hour appears one message...... but it doesnt work I have the idea to use the time() like this: time($bookings[$i-1][date("d.m.Y",$timestampOfMonday+($x*86400))]["daterequest"]) but the time that geve me back is the system time, not the time that is storage inside the array... then i have this idea.. but still not works..... $date1 = $bookings[$i-1][date("d.m.Y",$timestampOfMonday+($x*86400))]["daterequest"]; $date2 = time(); $dateArr = explode(".",$date1); $date1Int = mktime(0,0,0,$dateArr[1],$dateArr[2],$dateArr[0]) ; $dif = $date2-$date1/60/60/60; if (isset($bookings[$i-1][date("d.m.Y",$timestampOfMonday+($x*86400))])){ //IF There is a booking and the time of request is smaller than 1 hour, con make changes if $dif > 3600{ echo "...make something..." } //IF There is a booking and the time of request is bigger than 1 hour, NO changes can made else { echo ":....Say other thing.." } } THANKS FOR YOUR HELP!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/141921-compare-timestamp-with-time-in-array/ 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.