PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
Line 62: Line 62:


compare the timestamp and human readable time format using MySQL
compare the timestamp and human readable time format using MySQL
<pre>
SELECT @@global.time_zone, @@session.time_zone;


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' );
  /*  
  /*  
  1st column: timezone of UNIX_TIMESTAMP( ) is UTC
  1st column: timezone of UNIX_TIMESTAMP( ) is UTC
  2nd column: 'FROM_UNIXTIME( UNIX_TIMESTAMP( ) ,  '%Y-%m-%d %H:%i:%S' )' is server timezone dependent
  2nd column: 'FROM_UNIXTIME( UNIX_TIMESTAMP( ) ,  '%Y-%m-%d %H:%i:%S' )' is server timezone dependent
  */
  */
</pre>


==== today & yesterday ====
==== today & yesterday ====

Navigation menu