PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
m
Line 19: Line 19:


=== specified time ===
=== specified time ===
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", 1292897201 ); // convert the time stamp 1292897201 to the human readable time format
* php: echo date("y-m-d H:i:s", 1292897201 ); // convert the time stamp 1292897201 to the human readable time format
* mysql:
* mysql:
Line 26: Line 26:


convert human-readable time to timestamp
convert human-readable time to '''timestamp'''
* php:[http://php.net/manual/en/function.strtotime.php strtotime()]
* php:[http://php.net/manual/en/function.strtotime.php strtotime()]
* mysql: SELECT UNIX_TIMESTAMP('2011-03-15 18:53:57'); /* return timestamp: 1300186437 */
* mysql: SELECT UNIX_TIMESTAMP('2011-03-15 18:53:57'); /* return timestamp: 1300186437 */

Navigation menu