I should've posted this in the other thread, but anyway I have a time stamp
LogonTime: 20080510053516 Current Time: 20080510042225
They are in YYYYMMDDHHMMSS format.
So how would I determine the log on time. I tried Subtracting them, but It hasn't been giving me correct figures. My guess would be to pick out the hour/minute/sec part and convert those into seconds to be inserted into a table. Just doing that is what is stumping me.
You can convert it to a unix timestamp (seconds) with:
$timeStamp = '20080510053516'; $unixTime = strtotime($timeStamp);
Then subtract them and convert them back? or do I not need to reconvert them?
wat do you want to know of it?
If you want the time since logon: If you convert it and substract the current time from it, you would have the number of seconds since logon.
$LogonTime = strtotime("20080510053516"); $CurrentTime = strtotime("20080510042225"); echo $LogonTime-$CurrentTime;
When I do that its putting out 65059200. Am I not doing something correct?
I think I figured it out:
I did the following:
$LogonTime = gmmktime(05, 35, 16, 05, 10, 2008); $CurrentTime = gmmktime(04, 22, 25, 05, 10, 2008); echo $LogonTime-$CurrentTime;
That worked. Thanks for the help.