Hopefully someone can answer this.
Running this piece of code:
$date = "2nd January, 2013";
echo date("Y-m-d",strtotime($date));
Which returns:
2012-01-02.
Which clearly is not correct (or at least the results i’m hoping for)
Now based on some online research, this may possibly be passing it as time, rather then year. Is there a way to manage this, or do you have to supply dates in an american format for it to return correctly?
According to PHP’s acceptable date string format, comma is only acceptable in Textual month, day and year format:
m ([ .\t-])* dd [,.stndrh\t ]+ ySo you’ll have to either switch the position of month and day, or get rid of the comma:
codepad paste
I guess the reason the first statement returns 2012 is because characters after the comma are ignored, so the string is actually treated as
2nd January, and the current year is then assumed.