Since I suppose most folks don't make it into hours by milliseconds generally. If nothing else, it should be a good starting off point for folks trying to format their millisecond stopwatch times and the like.
Convert milliseconds to human readable format
Convert milliseconds to human readable format
This came up in IRC today, and since I spent the time to throw together the function I figured I may as well share it. It takes in milliseconds as an integer, and returns a formated string in the form of HH:MM:SS:mmm . So passing in 1234 would result in 00:00:01:234. this could fairly easily be edited to not show hours by changing the return line to:
Re: Convert milliseconds to human readable format
I wrote a function for this a few weeks ago and gave it to Vadi. I went with the fmod() option.
Re: Convert milliseconds to human readable format
Part of what I wanted to do with it was make something that'd be somewhat easy to pick apart for new scripters. The person requesting it didn't seem to have any idea where to start, so this seemed one of the easier ways to go about it and still leave it easily customizable.
That having been said, where's the code?! =)
That having been said, where's the code?! =)
Re: Convert milliseconds to human readable format
Hopefully he has it somewhere. I never kept it as it was just written out of boredom, heh.
Re: Convert milliseconds to human readable format
Totally thought I lost this, but it was finally located amongst a bunch of about 100 profiles, heh.