Search code examples
phpmktime

mktime function in case of Last day of a month in php


Understanding of last day of a month in the PHP function mktime

echo date("Y-m-d H:i:s", mktime(0, 0, 0, 2, 0, 2014));

Output is

2014-01-31 00:00:00

It should be

2014-02-28 00:00:00

Where is the wrong thing I am doing here?


Solution

  • I don't see the problem. It looks correct to me.

    You have asked for February 0, which is the day before February 1 AKA Jan 31.