Sam Luther
Sam Luther

Reputation: 1190

php strtotime gives strange result

Can someone explain why

echo date("Y-m-d",strtotime("Wednesday, 1 January, 2014")); 

returns

2013-01-02

Upvotes: 2

Views: 311

Answers (2)

Samuel Cook
Samuel Cook

Reputation: 16818

Drop the comma after January:

date_default_timezone_set('America/New_York');

echo date("Y-m-d",strtotime("Wednesday, 1 January 2014"));

strtotime() while flexible, still has strict standards of formatting.

Upvotes: 1

chandresh_cool
chandresh_cool

Reputation: 11830

Give proper format

strtotime("Wednesday, January 1, 2014")

Upvotes: 0

Related Questions