15,047
edits
(→now) |
|||
| Line 6: | Line 6: | ||
the '''human readable''' time format ex: 2010-12-21 10:05:06 | the '''human readable''' time format ex: 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' | * 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: | * 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 */ | ** 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 NOW()+0; //2011-04-01 12:19:43 returns 20110401122023.000000 | ||
| Line 20: | Line 20: | ||
SELECT UNIX_TIMESTAMP( ) , FROM_UNIXTIME( UNIX_TIMESTAMP( ) , '%Y-%m-%d %H:%i:%S' ); | SELECT UNIX_TIMESTAMP( ) , FROM_UNIXTIME( UNIX_TIMESTAMP( ) , '%Y-%m-%d %H:%i:%S' ); | ||
=== specified time === | === specified time === | ||