Jump to content

Compare TimeStamp with time in array


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 post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.