Mktime (HOUR,MINUTE,SECOND,MONTH,DAY,YEAR,IS_DST) This is mktime syntax, at a glance should not be difficult to write a timestamp code!
The following code is the online most people give the time stamp reality, this one can only say that a look at the current date, but not a timestamp, do not have to explain it!
1 $now = Mktime (0,0,0,date ("M"), Date ("D"), Date ("Y"));
2 echo "Now is". Date ("y/m/d", $now);
Show Results:
Now is 2012/05/30
Obviously this is not the result I want.
So, 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);
Note the red part, usually if the month is in M, then the minute should be M. Or the former with M, the latter with M.
Show Results:
Warning:mktime () expects parameter 2 to being long, string given in D:\usr\webroot\testPHP\index.php on line 46
Now is 1970/01/01 08:jan:00
It seems that it is not advisable to be judgmental, and PHP's syntax is somewhat different from other languages.
Not suspense, or directly to everyone the right 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 ~ is "i" instead of what m or m, here is a sample of this example just want to let PHP beginners to take a few detours.
As for what m means, we can understand it by doing it by ourselves ... Hey!!!
Show Results:
Now was 2012/05/30 04:54:25
There are too many people on the network to copy the article, not many people to dig into this, so that PHP beginners like me at a loss. Copy copy before you do not have to do a lot of their own implementation in writing, to oneself is an improvement, the reader is also always responsible attitude.
Excerpt from the East Blog
http://www.bkjia.com/PHPjc/478177.html www.bkjia.com true http://www.bkjia.com/PHPjc/478177.html techarticle mktime (HOUR,MINUTE,SECOND,MONTH,DAY,YEAR,IS_DST) This is mktime syntax, at a glance should not be difficult to write a timestamp code! The following code is online most people give ...