Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Date function

Tags:

date

php

I meet a trouble with php data function.

echo strtotime("31/05/2011");

It prints empty.

What's problem with this?

Thanks.

like image 448
Act DEV Avatar asked Jun 14 '11 15:06

Act DEV


1 Answers

DD/MM/YYYY Is not a valid date format (The manual outlines it must follow one of the supported date and time formats.) So, instead, it should be MM/DD/YYYY:

echo strtotime("05/31/2011");

Or, I guess as others have posted, the european (ISO8601 Notations) version uses hyphens:

echo strtotime("31-05-2011");
like image 182
Brad Christie Avatar answered Nov 15 '22 10:11

Brad Christie