PHP and MySQL syntax: Difference between revisions

Jump to navigation Jump to search
Line 157: Line 157:
* Use [http://www.w3schools.com/sql/func_date_format.asp MySQL DATE_FORMAT() Function]: {{kbd | key = <nowiki>DATE_FORMAT( time, '%Y-%m-%d')</nowiki>}}
* Use [http://www.w3schools.com/sql/func_date_format.asp MySQL DATE_FORMAT() Function]: {{kbd | key = <nowiki>DATE_FORMAT( time, '%Y-%m-%d')</nowiki>}}


 
=== timer ===
<pre>
SELECT @timer := CURRENT_TIMESTAMP();
SELECT SLEEP(2); //sleep 2 second
SELECT '自訂文字' AS 'action', CURRENT_TIMESTAMP() AS 'end time', @timer AS 'start time', TIMEDIFF(CURRENT_TIMESTAMP(), @timer) AS 'diff';
</pre>


=== further reading ===
=== further reading ===

Navigation menu