MySQL database date, IP, etc. processing

Source: Internet
Author: User

First, date

1, select Now ();

Query the current time, in the format: year-month-day time: minutes: seconds, such as 2015-12-17 17:37:20

2, select Unix_timestamp (); Converts a date of a string type to a second, and if no argument is passed, the number of seconds of the current time is queried

Example: Select Unix_timestamp (now ()), the number of seconds to query the current date, if you want to turn into milliseconds, you can use: Select Unix_timestamp (Now ()) *1000;

Select Unix_timestamp (' 2012-12-12 '); Output: 1355241600

3, select from_unixtime (seconds); pass in a second value of type int, convert adult-month-day time: minute: Seconds format, parameters must be passed

  

MySQL database date, IP, etc. processing

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.