Difference between SYSDATE () And NOW () in MySQL

Source: Internet
Author: User
MySQL has five functions that need to calculate the current time value: NOW. return time. The format is 2012-09-2306: 48: 28 CURDATE. The date of the returned time. The format is 2012-09.

MySQL has five functions that need to calculate the current time value: NOW. Return time, format: 06:48:28 CURDATE, return time date, format: 2012-09

MySQL has five functions that need to calculate the value of the current time:

  • NOW. Return time, format: 06:48:28
  • CURDATE: The date of the returned time. format:
  • CURTIME, return time. Format: 06: 48: 28
  • UNIX_TIMESTAMP, returns an integer timestamp, for example, 1348408108
  • SYSDATE, return time. The format is the same as the return time of the time () function, but there is a difference.
  • In addition to the differences returned by definitions, the first four functions return the statement-based start execution time, while SYSDATE returns the value of time.

    Through comparison, we can find the differences between the two functions:

    NOW:

    The two returned values are the same, because they indicate the start time of the statement.

    SYSDATE is executed as follows:

    Because of this difference, we usually use NOW () when executing the statement, because SYSDATE obtains the real-time at that time, this may lead to different execution return values of the master database and slave database, resulting in inconsistent Master/Slave Data.

    Other functions are executed as follows:

    ,

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.