Here is what I have:

```
$dateFormat = 'M d, Y';
$dateString = 'January 23, 2010';

```

What I need is a timestamp of `$dateString` so I can do this:

```
$newFormattedDate = date('Y-m-d', $timestamp);

```

I tried to use `strtotime` function but it tries to find out the format itself and doesn't work always. In my situation I know both the date string and date format.

How can I set `$timestamp` to an appropriate value for use with the [`date`](http://www.php.net/manual/en/function.date.php) function?

EDIT: I need this to work in both Linux and Windows environments.

EDIT: The solution must support PHP version 4 or higher

EDIT: MySQL has a function called [`STR_TO_DATE`](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date) which takes a date string and a date format and returns `Y-m-d` formatted date string. Any equivalent function for php works for me also.