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
$requiredFormat='Y-m-d';
Function($givenDate,$givenFormat){
//convert given date to yyyy-mm-dd format
return $yyyy-mm-dd;
}
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.
I cant use strtotime function because the format may differ in different calls.
The required function will get 2 arguments (arrivedDate,arrivedDateFormat)
And using these 2 argument , convert the arrivedDate to YYYY-mm-dd format
So Please provide me the best way to do this.
Finally I got my required function