Jump to content

Archived

This topic is now archived and is closed to further replies.

BDwinsAlt

Milliseconds to time and Date

Recommended Posts

Can anyone lead me in the right direction to converting milliseconds to the correct time and date?
I am using a bot in this game that stores the last login time in milliseconds, I haven't been able to get the exact code I need to convert this into H:M:S on MM:DD:YYYY

Thanks.

Share this post


Link to post
Share on other sites
Please show an example time string, so we can see what it exactly is.

me!

Share this post


Link to post
Share on other sites
Last Login: 1159916451

[code]
        $lastseen = $row['lastseen'];
        echo('<br /> Last login: ' . $lastseen . '<br />');
[/code]

Share this post


Link to post
Share on other sites
That's not milliseconds, that number is the number of seconds that have elapsed since the base time of 1/1/1970. To see what it is in readable notation, use the date() function:
[code]<?php
$str = 1159916451;
echo date('l,F j, Y  g:i a',$str);
?>[/code]

Ken

Share this post


Link to post
Share on other sites
like so, (it a timestamp)

[code]<?

echo date ( 'H:i:s \o\n m:d:Y', 1159916451 );

?>[/code]


me!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.