chowderrunnah Posted February 7, 2015 Share Posted February 7, 2015 I have a online database with a column called consoles. Inside that, I have 2 rows called time and expire, I want to take the expire colum and minus it from the time now to tell them how long they have left online. I also have another column called cpukey, this is for when they type in something, it checks the cpukey column and does their information. I have something like this so far : http://gyazo.com/40feb904fc933a4d6b8392e99392c4bb , but it just displays the key again, I need it to take away the expire column by the time now. Anyone help me I would be really thankfull. Quote Link to comment Share on other sites More sharing options...
Barand Posted February 7, 2015 Share Posted February 7, 2015 Use TIMEDIFF() function EG mysql> SELECT TIMEDIFF('2015-02-07 18:00:00', NOW()) as time_remain; +-------------+ | time_remain | +-------------+ | 02:53:29 | +-------------+ Quote Link to comment Share on other sites More sharing options...
chowderrunnah Posted February 7, 2015 Author Share Posted February 7, 2015 Use TIMEDIFF() function EG mysql> SELECT TIMEDIFF('2015-02-07 18:00:00', NOW()) as time_remain; +-------------+ | time_remain | +-------------+ | 02:53:29 | +-------------+ so how would I set it out ? mysql> SELECT TIMEDIFF('2015-02-07 18:00:00', NOW()) as time_remain; what is this table called or do I need to create a new table ? Quote Link to comment Share on other sites More sharing options...
Barand Posted February 7, 2015 Share Posted February 7, 2015 I don't know what the table is called. It's your table. I am just showing how to subtract the current time from another and get the result SELECT TIMEDIFF(expire, NOW()) as time_remain FROM whateveryourtableiscalled Quote Link to comment 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.