使用strtotime时如何避免歧义

Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.

I need to get unixtimestamp from date which is in format MM-DD-YYYY HH:MM:SS According to php.net doc if date separator is dash (-) then DD-MM-YYYY format is assumed this returns invalid timestamps.

Is there an alternate to strtotime() in PHP 5.2x or any other workaround ?

Replace the dashes with slashes:

strtotime(str_replace('-', '/', "08-10-2012 09:54:00"));