PHP count, add colons every 2 characters

Viewed 12386

I have this string

1010081-COP-8-27-20110616214459

I need to count the last 6 characters starting from the end of this string (because it could may be long starting from the begin)

Then I need to add colons after every 2 characters.

So after counting 6 characters from the end it will be

214459

After having added the colons it will look like:

21:44:59

Can you help me achieving it?

I do not really know where to start!

Thank you

4 Answers
Related