Forum Moderators: coopster

Message Too Old, No Replies

Convert to milliseconds

         

mudogg80

8:31 pm on Dec 18, 2007 (gmt 0)

10+ Year Member



Sorry if this has been posted already, but I have a document that has times listed like:
00:00:01:32
00:00:02:12
00:00:04:15
00:00:05:32

I would like to convert these times to milliseconds and I'm having a little trouble with the conversion. The output would be something like:
1032
2012
4015
5032

Can someone give me a helping hand, it would be greatly appreciated.

cameraman

10:08 pm on Dec 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For each one you want to convert:
if(preg_match('/(\d\d):(\d\d)$/',$toconvert,$parts))
$val = ($parts* 1000) + $parts[2];

[1][edited by: eelixduppy at 10:11 pm (utc) on Dec. 18, 2007]
[edit reason] disabled smileys [/edit]