PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
Line 14: Line 14:
the current '''timestamp''' ex: 1292897201
the current '''timestamp''' ex: 1292897201
* php: {{kbd | key=<nowiki>echo time();</nowiki>}} //Return 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 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>}} //Return the number of seconds since 1970/01/01 ex: 2011-05-30 01:56:38 returns 1306720622
* mysql: {{kbd | key=<nowiki>SELECT UNIX_TIMESTAMP();</nowiki>}} //Return the number of seconds since 1970/01/01 ex: 2011-05-30 01:56:38 returns 1306720622
* javascript: getTime() Method ex: {{kbd | key=<nowiki>new Date().getTime();</nowiki>}} //Return the number of milliseconds since 1970/01/01 <ref>[http://w3schools.com/jsref/jsref_gettime.asp JavaScript getTime() Method]</ref>
* javascript: getTime() Method ex: {{kbd | key=<nowiki>new Date().getTime();</nowiki>}} //Return the number of milliseconds since 1970/01/01 <ref>[http://w3schools.com/jsref/jsref_gettime.asp JavaScript getTime() Method]</ref>

Navigation menu