Time Stamp Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Commander-X
    New Member
    • Nov 2008
    • 19
    • 3.7.x

    Time Stamp Question

    I have made a login script outside vb pages and I want to display the last date the user visited the forums on this log in script. I made a query to the vb databse and found out that the data on the lastvisit table isn't a normal time stamp , I guessed it's in unix timestamp so I tried converting it like so:


    Code:
     
    <?php
    $int = mktime(1227537906);
    echo date('m-d-Y', $int);
    ?>
    But it's giving me the wrong date, is the data in UNIX time stamp? or I'm just presumming wrong.

    How can I convert the data using php and have a human readable date?
  • Commander-X
    New Member
    • Nov 2008
    • 19
    • 3.7.x

    #2
    Nah nevermind I got it I'm doing it all wrong !!! Found this function in google:

    Code:
     
    
    function unixToMySQL($timestamp)
    {
        return date('Y-m-d H:i:s', $timestamp);
    }
    
    /*** example usage ***/
    $time = time(1227537906);
    echo unixToMySQL($time);
    Hmm come to think of it almost all of my problems with VB are answered using google search!

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...