Home >> FAQs/Tutorials >> MySQL Tutorials

MySQL Tutorial - Ways to Get the Current Time

By: FYIcenter.com

(Continued from previous topic...)

How Many Ways to Get the Current Time?

There are 8 ways to get the current time:

SELECT NOW() FROM DUAL;
   2006-07-01 10:02:41 

SELECT CURRENT_TIME() FROM DUAL;
   10:02:58

SELECT SYSDATE() FROM DUAL;
   2006-07-01 10:03:21 

mysql> SELECT CURRENT_TIMESTAMP() FROM DUAL;
   2006-07-01 10:04:03 

SELECT LOCALTIME() FROM DUAL;
   2006-07-01 10:07:37 

mysql> SELECT LOCALTIMESTAMP() FROM DUAL;
   2006-07-01 10:08:08 

mysql> SELECT UTC_TIME() FROM DUAL;
   14:09:22 

mysql> SELECT UTC_TIMESTAMP() FROM DUAL;
   2006-07-01 14:09:49 

  1. What Are Date and Time Data Types?
  2. How To Write Date and Time Literals?
  3. How To Enter Microseconds in SQL Statements?
  4. How To Convert Dates to Character Strings?
  5. How To Convert Character Strings to Dates?
  6. What Are Date and Time Intervals?
  7. How To Increment Dates by 1?
  8. How To Decrement Dates by 1?
  9. How To Calculate the Difference between Two Dates?
  10. How To Calculate the Difference between Two Time Values?
  11. How To Present a Past Time in Hours, Minutes and Seconds?
  12. How To Extract a Unit Value from a Date and Time?
  13. What Are Date and Time Functions?
  14. What Is TIMESTAMP Data Type?
  15. How Many Ways to Get the Current Time?

MySQL Tutorials:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...