Time function in MySQL---operation and maintenance commonly used

Source: Internet
Author: User
Tags string format

First, check the current time

Now function
Mysql> Select Now (); +---------------------+| Now () |+---------------------+| 2016-04-29 22:04:42 |+---------------------+1 row in Set (0.00 sec)




Second, the time to get the string format through Unix time

From_unixtime function
Mysql> Select From_unixtime (1461938772); +---------------------------+| From_unixtime (1461938772) |+---------------------------+| 2016-04-29 22:06:12 |+---------------------------+1 row in Set (0.17 sec)


Application:

Select From_unixtime (clock) As date, UserID, action, IP, resourcename from auditlog where clock>%s; "% Yest_clock



Note: Linux gets the current Unix time date +%s


Three





This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1769120

Time function in MySQL---operation and maintenance commonly used

Related Article

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.