Jump to content

Recommended Posts

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!!!!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/141921-compare-timestamp-with-time-in-array/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.