Convert specific string to time in PHP
date, php, strtotime
Solution
You're calling the function completely wrong. Just pass it
$time = strtotime('21 nov 2012')
The 2nd argument is for passing in a timestamp that the new time is relative to. It defaults to `time()`.
Edit: That will return a unix timestamp. If you want to then format it, pass your new timestamp to the `date` function.
Problem
I need to convert a string into date format, but it's returning a weird error. The string is this: ``` 21 nov 2012 ``` I used: ``` $time = strtotime('d M Y', $string); ``` PHP returned the error: ``` Notice: A non well formed numeric value encountered in index.php on line 11 ``` What am I missing here?