Jump to content

Subtract from timestamp


cdoyle

Recommended Posts

Hi,

 

I have a field in my table that has a Timestamp.

It's basically used for when a player is no longer dead in the game.

 

The player is considered dead until current time is great then the timestamp.

I was able to get this working and seems to work great.

 

So now to the next part..

I want to give users a way to buy there way out of the hospital.

so I'm trying to create an update query to subtract from that timestamp, but I can't seem to get it to work.

 

for a test I'm trying to subtract a set amount.

$query = $db->execute("update `players` set `dead_time_remaining`=`dead_time_remaining`-?, where `id`=?", array(120, $player->id));

 

A timestamp is seconds right?  So the 120 would be 120 seconds right?

Right now, it's not subtracting anything when I run the query.

 

Link to comment
https://forums.phpfreaks.com/topic/123359-subtract-from-timestamp/
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.