PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
m
Line 50: Line 50:


==== the current '''timestamp''' ====
==== the current '''timestamp''' ====
ex: 1292897201
the number of seconds since 1970/01/01
* php: {{kbd | key=<nowiki>echo time();</nowiki>}} //Return the number of seconds since 1970/01/01
* php: {{kbd | key=<nowiki>echo time();</nowiki>}}
* php: {{kbd | key=<nowiki>echo microtime();</nowiki>}}  [http://php.net/manual/en/function.microtime.php PHP: microtime - Manual] "Returns current Unix timestamp with microseconds" //ex: 0.45920500 1406776901
* php: {{kbd | key=<nowiki>echo microtime();</nowiki>}}  [http://php.net/manual/en/function.microtime.php PHP: microtime - Manual] "Returns current Unix timestamp with microseconds" //ex: 0.45920500 1406776901
* mysql: {{kbd | key=<nowiki>SELECT UNIX_TIMESTAMP();</nowiki>}} //ex: 2011-05-30 01:56:38 returns 1306720622
* mysql: {{kbd | key=<nowiki>SELECT UNIX_TIMESTAMP();</nowiki>}} //ex: 2011-05-30 01:56:38 returns 1306720622

Navigation menu