PHP and MySQL syntax: Difference between revisions
Jump to navigation
Jump to search
(Created page with "the current time ex: 2010-12-21 10:05:06 * php: echo date("y-m-d H:i:s", time()); * mysql: SELECT NOW(); the current timestamp ex: 1292897201 * php: echo time(); * mysql: SELECT...") |
mNo edit summary |
||
| Line 14: | Line 14: | ||
* [http://php.net/manual/en/book.datetime.php PHP Date and Time functions] | * [http://php.net/manual/en/book.datetime.php PHP Date and Time functions] | ||
* [http://dev.mysql.com/doc/refman/5.0/en/datetime.html MySQL The DATETIME, DATE, and TIMESTAMP Types] | * [http://dev.mysql.com/doc/refman/5.0/en/datetime.html MySQL The DATETIME, DATE, and TIMESTAMP Types] | ||
* [http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html MySQL Date and Time Functions] | |||
[[Category:Programming]] | [[Category:Programming]] | ||
Revision as of 18:18, 21 December 2010
the current time ex: 2010-12-21 10:05:06
- php: echo date("y-m-d H:i:s", time());
- mysql: SELECT NOW();
the current timestamp ex: 1292897201
- php: echo time();
- mysql: SELECT NOW()+0;
time difference of two time values
- php: using mktime() function
- mysql: SELECT TIMEDIFF('2010:01:01 00:00:00', '2010:02:01 00:00:00');