I need the datam in a string likeconvert 20010611 for some calculations, but when I output to the user I need it in the 11/06/2001.
I used to use a function that used the unpack function within it...
I lost the function and don“t remember how I wrote it ... how can I do it
If the format is allways yyyymmdd, then you could use something like
echo substr($string,6,2).'/'.substr($string,4,2).'/'.substr($string,0,4);
You can use this function:
function arrangedate($string) { $date = split('/', $string); $arranged = "$date[2]/$date[1]/$date[0]";
return $arranged; }
Ehm.. the source string did not have an slashes in it....
Ops... sorry!!! I didn't realize that.
So, I think the best way is the first one (posted by you).
Luiz Vitor