PHP Tip, using date()

When using the date() function, keep in mind that you should use date(“i”) to obtain the minute. A great deal of code incorrectly uses date(“m”) for this, e.g.

$timenow = date(“H:m:s”); //incorrect

Passing “m” to the date() function will return the current month as a number from 1 to 12, not the current minute.

Comments are closed.