I have generated timestamp using new Cassandra\Timestamp()
in php.
Now I want to add 2 hours to this generated time using php and then store it in the database (Cassandra).
Essentially I want to do something like this:
$dt= new Cassandra\Timestamp();
$new_dt= $dt+3*3600; //here 3 is in hours
$query=$session->prepare('INSERT INTO tracker_table(id,deadline)VALUES(?,?)');
$session->execute($query,array('arguments'=>array(new \Cassandra\Uuid(),$new_dt)));
**HERE deadline column has datatype set as timestamp.
The problem I am facing here is $dt returns an object datatype so I can't add 3 hours to it directly. And even if I am able to somehow add 3 hours to it then cassandra is not accepting it as viable input.
So, is it possible to add 3 hours directly to cassandra timestamp this way or should I deal with time stored as strings in DB.
My endgame is to store a deadline and then compare the current time to the stored deadline and if current time is greater then execute some code. something like this:
$current_time=time();
if ($current_time>$deadline){echo "hello"; }
This should do the work;
$now = time(); // get current timestamp
$new_dt = new Cassandra\Timestamp($now + (3 * 3600));