PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
m
Line 7: Line 7:
* php: echo date("Y-m-d H:i:s", time() ); //Convert the time stamp of current time to the human readable time format. Ex: return '2010-12-21 10:05:06'
* php: echo date("Y-m-d H:i:s", time() ); //Convert the time stamp of current time to the human readable time format. Ex: return '2010-12-21 10:05:06'
* mysql: which mapping to DATETIME type<ref>[http://dev.mysql.com/doc/refman/5.1/en/datetime.html MySQL :: MySQL 5.1 Reference Manual :: 11.3.1 The DATE, DATETIME, and TIMESTAMP Types]</ref>
* mysql: which mapping to DATETIME type<ref>[http://dev.mysql.com/doc/refman/5.1/en/datetime.html MySQL :: MySQL 5.1 Reference Manual :: 11.3.1 The DATE, DATETIME, and TIMESTAMP Types]</ref>
** SELECT NOW(); /*return the human readable current time: 2011-04-01 12:19:43 */
** {{kbd | key=<nowiki>SELECT NOW();</nowiki>}} /*return the human readable current time: 2011-04-01 12:19:43 */
** SELECT NOW()+0; //2011-04-01 12:19:43 returns 20110401122023.000000
** {{kbd | key=<nowiki>SELECT NOW()+0;</nowiki>}} //2011-04-01 12:19:43 returns 20110401122023.000000
** SELECT CURRENT_TIMESTAMP; /*return the human readable current time: 2011-04-01 12:19:43 */
** {{kbd | key=<nowiki>SELECT CURRENT_TIMESTAMP;</nowiki>}} /*return the human readable current time: 2011-04-01 12:19:43 */
* EXCEL: {{kbd | key=<nowiki>=TODAY()</nowiki>}} Returns the current date. ex: 2013/9/9 <ref>[http://office.microsoft.com/en-gb/excel-help/today-function-HP010062297.aspx TODAY function - Excel - Office.com]</ref>
** {{kbd | key=<nowiki>SELECT current_date;</nowiki>}} /* Return {{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}} */
* EXCEL: {{kbd | key=<nowiki>=TODAY()</nowiki>}} Returns the current date. ex: {{CURRENTYEAR}}/{{CURRENTMONTH}}/{{CURRENTDAY2}} <ref>[http://office.microsoft.com/en-gb/excel-help/today-function-HP010062297.aspx TODAY function - Excel - Office.com]</ref>


the current '''timestamp''' ex: 1292897201
the current '''timestamp''' ex: 1292897201

Navigation menu