PHP and MySQL syntax

From LemonWiki共筆
Revision as of 13:43, 21 December 2010 by Planetoid (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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');