Question: I'm trying to improve the readibility of a published date being pulling in from a twitter XML file. 

Currently the time date being displayed is `2012-02-10T14:20:08Z` 

I have applied a regex to this and now displays `2012-02-10 14:20:08 GMT`

Now all i need to do is to convert the date from the US format to the UK format. I have looked into this and see it is possible to use **strtodate** function. But I'm unsure on how to go about doing this.

```
                <strong>Tweets within 10 miles radius of London Eye</strong></br>
                <?php
                $feed = simplexml_load_file('http://search.twitter.com/search.atom?geocode=' . $feed1 . '%2C' . $range . '%22london%22&' . $lang . '&' . $amount);
                if ($feed) {
                    foreach ($feed->entry as $item) {

                        $string = $item->published;

//                            $unixdate = strtotime($string);
//                            $ukDate = date('d/m/20y', $unixdate);

                        $find = array('/T/', '/Z/');
                        $replace = array(' ', ' GMT');

                        echo '<a href=\'' . $item->link->attributes()->href . '\'>' . $item->title . '</a>', '</br>' . preg_replace($find, $replace, $string), '</br>';
                    }
                }
                else
                    echo "Cannot find Twitter feed!"
                    ?>

```

Is is possible to combine these functions together or is there a better way to do this?

Thanks in advance.

Answer: 
Something like this should do it. Just pass the date for format with the regex into the strtotime function. You might also need to remove the `GMT` string from the regexed date.

```
$date = preg_replace($find, $replace, $string);
$formatted = date('d/m/Y', strtotime($date));

echo '<a href=\'' . $item->link->attributes()->href . '\'>' . $item->title . '</a>', '</br>' . $formatted, '</br>';

```
No need for strtodate and regex - just use date() and pass in the relevant format. See <http://www.php.net/manual/en/function.date.php>.