Here is what I have:
$dateFormat = 'M d, Y';
$dateString = 'January 23, 2010';
I need a timestamp $dateString, so I can do this:
$newFormattedDate = date('Y-m-d', $timestamp);
I tried to use the function strtotime, but it tries to find the format itself and does not always work. In my situation, I know both the date string and the date format.
How to set $timestampto the appropriate value for use with the datefunction?
EDIT: I need this to work on both Linux and Windows.
EDIT: solution must support PHP version 4 or higher
EDIT: MySQL has a function STR_TO_DATEthat takes a date string and a date format and returns a format date string Y-m-d. Any equivalent function for php works for me as well.