PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
m
Line 6: Line 6:
* mysql:  
* mysql:  
** SELECT NOW(); /*return the human readable current time: 2011-04-01 12:19:43 */
** SELECT NOW(); /*return the human readable current time: 2011-04-01 12:19:43 */
** SELECT NOW()+0; //2011-04-01 12:19:43 returns 20110401122023.000000
** SELECT CURRENT_TIMESTAMP;  
** SELECT CURRENT_TIMESTAMP;  


the current timestamp ex: 1292897201
the current timestamp ex: 1292897201
* php: echo time();
* php: echo time();
* mysql: SELECT NOW()+0; //2011-04-01 12:19:43 returns 20110401122023.000000
* mysql: SELECT UNIX_TIMESTAMP(); //2011-05-30 01:56:38 returns 1306720622
* javascript: [http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript datetime - How do you get a timestamp in JavaScript? - Stack Overflow] {{access | date = 20110323}}
* javascript: [http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript datetime - How do you get a timestamp in JavaScript? - Stack Overflow] {{access | date = 20110323}}


Navigation menu