15,047
edits
| Line 2: | Line 2: | ||
== time / timestamp == | == time / timestamp == | ||
Convert ''' | Convert '''unix timestamp''' (the number of seconds since 1970/01/01) <--> to the '''human readable time''' format | ||
=== now === | === now === | ||
the '''human readable''' time format ex: {{Template:Today}} {{CURRENTTIME}}:06 | the '''human readable''' time format ex: {{Template:Today}} {{CURRENTTIME}}:06 | ||
| Line 15: | Line 15: | ||
* 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 | * 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>}} // | * mysql: {{kbd | key=<nowiki>SELECT UNIX_TIMESTAMP();</nowiki>}} //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> | ||
* EXCEL: [http://stackoverflow.com/questions/1703505/excel-date-to-unix-timestamp Excel date to Unix timestamp - Stack Overflow] | * EXCEL: [http://stackoverflow.com/questions/1703505/excel-date-to-unix-timestamp Excel date to Unix timestamp - Stack Overflow] | ||