Solved

php string convert

Posted on 2012-04-03
2
217 Views
Last Modified: 2012-04-03
I need to convert a string from 170652 to 17:06:52
0
Comment
Question by:glynco
2 Comments
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 500 total points
ID: 37800272
Try like this

$time = "170652";

$new_time = implode(':', str_split($time, 2));

echo $new_time
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 37800324
$value2 = "170652";
$words2 = str_split($value2, 2);
print_r($words2[0].':'.$words2[1].':'.$words2[2]);
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now