PHP : Convert One date format to another for dynamic incoming data format
<p>I have a problem in my application. I have to convert arriving date string to server date format. So I planned to sent date along with the date format to the model class.
Like </p>

<pre><code>$requiredFormat='Y-m-d';
Function($givenDate,$givenFormat){
//convert given date to yyyy-mm-dd format
return $yyyy-mm-dd;
}
</code></pre>

<p>I have different types of client for my model,
My web client use one format, and my mobile clients use another format,
So I decide sent date format along with the date.</p>

<p>I cant use strtotime function because the format may differ in different calls.
<strong>The required function will get 2 arguments (arrivedDate,arrivedDateFormat)
And using these 2 argument , convert the arrivedDate to YYYY-mm-dd format</strong>
So Please provide me the best way to do this.</p>
