The following code is the online most people give the time stamp reality, this one see can only say is to get the current date, but not a time stamp, do not have more explanation!
Copy Code code as follows:
$now = Mktime (0,0,0,date ("M"), Date ("D"), Date ("Y"));
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:
Copy Code code as follows:
$now = mktime (Date ("H"), Date ("M"), date ("s"), date ("M"), Date ("D"), Date ("Y"));
echo "Now is". Date ("Y/m/d h:i:s", $now);
Notice the red part, usually if the month is M, then the minute should be M. Or the former with M, the latter with M.
Show Results:
Copy Code code as follows:
Warning:mktime () expects parameter 2 to is long, string given in D:\usr\webroot\testPHP\index.php on line 46
Now is 1970/01/01 08:jan:00
It seems that the assumption is not desirable, PHP syntax and other languages are still somewhat different.
No suspense, or just give us the right answer.
Copy Code code as follows:
$now = mktime (Date ("H"), Date ("I"), date ("s"), date ("M"), Date ("D"), Date ("Y"));
echo "Now is". Date ("Y/m/d h:i:s", $now);
haha ~ is "i" instead of what m or m, here is the example for everyone just want to let the beginner of PHP to take a few detours.
As for M. What does it mean, everyone will understand it by themselves ... Hey!!!
Show Results:
Copy Code code as follows:
Now is 2012/05/30 04:54:25
There are too many people on the Internet to copy articles, not many people to delve into this, so as I like the PHP beginners at a loss. We copied before the copy is not more to do their own implementation in writing, to their own is an improvement, the reader has been responsible for the attitude.