MyBB Community Forums

Full Version: Last Visit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm working on a new theme. I'm trying to display a users last visit but I don't want to edit the language file. I'm using the following code:

{$mybb->user['lastvisit']}

It does work however I get all the details in numbers, not in the date format.

Screenshots

Template: http://puu.sh/4qMJG.png
Result: http://puu.sh/4qMKl.png

Actual in Welcomeblock: http://puu.sh/4qML6.png

Is the information in the database encrypted or something? Why is it displaying that way?
Hey bro, its a UNIX time stamp. Always date and time are stored in UNIX time stamp. So you need to convert this value on retrieval to get actual readable date and time format!!! Smile Smile

You can try converting to check what it means if you want online here or on some other websites for your understanding.
why not use {$lang->welcome_back}
You can see the actual date and time once you convert the UNIX time stamp like as below:
[Image: OJGRUvU.png]
I didn't want to use {$lang->welcome_back} because I didn't want the welcome back username and to remove that, I would have to edit the language file.
Why not just use the PHP DATE function to convert fron unix time stamp to whatever format you want. See http://uk3.php.net/manual/en/function.date.php
Using {$lastvisit} instead of {$mybb->user['lastvisit']} should work
Shoot. I can't believe I missed that one Destroy. Thanks a ton.