change date format in php
<p>i develop a webpage , in that i need to change the date format from 22/01/2010 to 2010-01-22 
i use the following function but i am getting a warning as "Deprecated : Function ereg() is depreceted in c:\wamp\www\testpage.php on line 33" . Is there anyway to hide that error or is there any other way to change the date format ? Please help me to solve this issue . 
Thanks in advance . </p>

<pre><code>$datedue = $_REQUEST['txtJoiningdate'];
        $r = ereg ("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})", $datedue, $redgs);
        $billdate=$redgs[3]."-".$redgs[2]."-".$redgs[1];
</code></pre>
