BDwinsAlt Posted October 3, 2006 Share Posted October 3, 2006 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:YYYYThanks. Quote Link to comment Share on other sites More sharing options...
printf Posted October 3, 2006 Share Posted October 3, 2006 Please show an example time string, so we can see what it exactly is.me! Quote Link to comment Share on other sites More sharing options...
BDwinsAlt Posted October 3, 2006 Author Share Posted October 3, 2006 Last Login: 1159916451[code] $lastseen = $row['lastseen']; echo('<br /> Last login: ' . $lastseen . '<br />');[/code] Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 3, 2006 Share Posted October 3, 2006 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 Quote Link to comment Share on other sites More sharing options...
printf Posted October 3, 2006 Share Posted October 3, 2006 like so, (it a timestamp)[code]<?echo date ( 'H:i:s \o\n m:d:Y', 1159916451 );?>[/code]me! Quote Link to comment Share on other sites More sharing options...
BDwinsAlt Posted October 4, 2006 Author Share Posted October 4, 2006 This worked! Thanks! ;D 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.