Mktime (hour, minute, second, month, day, year, is_dst) is the syntax of mktime. It is not difficult to write a timestamp code at a glance! The following code is a timestamp provided by most people on the Internet. At first glance, it can only be said that the current date is obtained, rather than the timestamp. Do not explain it more!
1 $now = mktime(0,0,0,date("m"),date("d"),date("Y"));2 echo "now is ".date("Y/m/d", $now);
Display result:
Now is 2012/05/30
Obviously, this is not the result I want.
As a result, according to the old thinking, I take it for granted to the following form:
1 $now = mktime(date("h"),date("M"),date("s"),date("m"),date("d"),date("Y"));2 echo "now is ".date("Y/M/d h:i:s", $now);
Pay attention to the red part. Generally, if the month is m, the minute should be M. Or the former uses m, and the latter uses M.
Display result:
Warning: mktime() expects parameter 2 to be long, string given in D:\usr\webroot\testPHP\index.php on line 46now is 1970/01/01 08:Jan:00
It seems that subjective assumptions are not advisable. The PHP syntax is different from other languages.
Don't sell off the customs, or directly give you the correct answer
1 $now = mktime(date("h"),date("i"),date("s"),date("m"),date("d"),date("Y"));2 echo "now is ".date("Y/m/d h:i:s", $now);
Haha ~ It is "I" rather than m or M. Here we will give you an example to avoid detours for PHP beginners.
As for what m means, you can understand it after you do it yourself... hey !!!
Display result:
now is 2012/05/30 04:54:25
There are too many people who copy articles on the Internet. Not many people go into this, making PHP beginners like me at a loss. Before copying and copying data, do you want to write more manually? This is an improvement for yourself and a always-responsible attitude for readers.