BillyBoB Posted August 17, 2006 Share Posted August 17, 2006 i have a timestamp in a db called timein i want to have it show the how long its been since the last login.i want it to take time out of db and compare it with the date() function of php and display the dtime between them.Can u help me ? (there happy) Quote Link to comment Share on other sites More sharing options...
trq Posted August 17, 2006 Share Posted August 17, 2006 Cool. Quote Link to comment Share on other sites More sharing options...
Nothadoth Posted August 17, 2006 Share Posted August 17, 2006 I think that was your que to help him. Not say coolSorry billy, im a newb i cant help. Just thought thorpe's post was dumb Quote Link to comment Share on other sites More sharing options...
trq Posted August 17, 2006 Share Posted August 17, 2006 Statements are not questions, its a pretty simple concept. You'll find a link in my signiture if you need clarification. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 17, 2006 Author Share Posted August 17, 2006 dude stop being an ass just anwser my question Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted August 17, 2006 Share Posted August 17, 2006 Just subtract the times.$time_inbetween = $current_time - $intime;Where $current_time is the current timestamp and $intime is the timestamp in the database. $timeinbetween should be a timestamp (the number of seconds between the two other timestamps)So use date() with $time_inbetween to get the number of hours/minutes/seconds/days/weeks or whatever you want. Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 17, 2006 Author Share Posted August 17, 2006 nope that wont work ... it will not work because what if the timein is jan. (01) and the current time is nov. (11) that would give me -10 Quote Link to comment Share on other sites More sharing options...
redarrow Posted August 17, 2006 Share Posted August 17, 2006 this should of worked sorry no luck.[code]<?php$old_date=date("01-02-09");$old_result=strtotime($old_date);$date_now=date("d-m-y");$date_now_result=strtotime($date_now);$results=$date_now_result-$old_result;$total_result=date("d-m-y",$results);echo $total_result;?>[/code] Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted August 17, 2006 Share Posted August 17, 2006 [quote author=BillyBoB link=topic=104559.msg417180#msg417180 date=1155781902]nope that wont work ... it will not work because what if the timein is jan. (01) and the current time is nov. (11) that would give me -10[/quote]It should work if all three variables in my example are timestamps. Quote Link to comment Share on other sites More sharing options...
trq Posted August 17, 2006 Share Posted August 17, 2006 [quote]dude stop being an ass just anwser my question[/quote]Read your post again. There is no question! Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted August 17, 2006 Author Share Posted August 17, 2006 [quote author=BillyBoB link=topic=104559.msg417135#msg417135 date=1155774890]Can u help me ? (there happy)[/quote]whats that i can see one how bout u Quote Link to comment Share on other sites More sharing options...
trq Posted August 17, 2006 Share Posted August 17, 2006 Oh... well, [b]no[/b] then. 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.