Vivid Lust Posted April 24, 2009 Share Posted April 24, 2009 If i wrote: echo time() - 30; Would that be the time minus 30 minutes from now??? Thanks,, Jake. Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/ Share on other sites More sharing options...
premiso Posted April 24, 2009 Share Posted April 24, 2009 30 seconds. But it will show a timestamp of the time - 30 seconds. Use date to display it in a readable format. Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-818459 Share on other sites More sharing options...
wildteen88 Posted April 24, 2009 Share Posted April 24, 2009 No that'll be minus 30 seconds. For minutes you could do echo time() - (60 * 30); Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-818460 Share on other sites More sharing options...
.josh Posted April 24, 2009 Share Posted April 24, 2009 If i wrote: echo time() - 30; Would that be the time minus 30 minutes from now??? Thanks,, Jake. Well if we want to play the semantics game, "the time minus 30 minutes from now" would actually be expressed as time() - (time() + (30*60)) Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-818470 Share on other sites More sharing options...
Vivid Lust Posted April 24, 2009 Author Share Posted April 24, 2009 Ok, I'm making a "users online" script. And in the database set the time field as a timestamp one, and using the "time() - (30*60); it doesnt seem to be working, any ideas??? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-818487 Share on other sites More sharing options...
Vivid Lust Posted April 24, 2009 Author Share Posted April 24, 2009 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-818548 Share on other sites More sharing options...
Vivid Lust Posted April 25, 2009 Author Share Posted April 25, 2009 Well thanks for the previous help guys! Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-819002 Share on other sites More sharing options...
Daniel0 Posted April 25, 2009 Share Posted April 25, 2009 How "doesn't it work"? Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-819006 Share on other sites More sharing options...
Vivid Lust Posted April 25, 2009 Author Share Posted April 25, 2009 When updating the value in the database, the database just reads as " 0000-00-00 00:00:00" as if the timestamp and time() arent compatible Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-819017 Share on other sites More sharing options...
Vivid Lust Posted April 25, 2009 Author Share Posted April 25, 2009 Ok, I printed the SQL Query which im using and tested in in the SQL in PHPmyAdmin and it works fine - no errors: UPDATE member SET lastOnline = '1240663406' WHERE userName = 'Jake' And what the problem is, is that the "lastOnline" field is just showing a load of 0s! This: 0000-00-00 00:00:00 Any ideas???? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-819028 Share on other sites More sharing options...
Daniel0 Posted April 25, 2009 Share Posted April 25, 2009 What type is lastOnline? Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-819030 Share on other sites More sharing options...
Vivid Lust Posted April 25, 2009 Author Share Posted April 25, 2009 lastOnline timestamp ON UPDATE CURRENT_TIMESTAMP No CURRENT_TIMESTAMP Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-819032 Share on other sites More sharing options...
Vivid Lust Posted April 25, 2009 Author Share Posted April 25, 2009 changed to varchar and worked Quote Link to comment https://forums.phpfreaks.com/topic/155533-solved-php-time/#findComment-819041 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.