How to convert the time value converted by php in mysql

Source: Internet
Author: User
How can I convert the time value converted by php in mysql? The converted time through the php & nbsp; date function is stored in the mysql database 1391768710 & nbsp; this represents February 7, 2014 & nbsp; how can I get the time in mysql? what kind of time functions in mysql can be directly converted to the time format? For example, if my field is begintime & nbsp; table name: tab_informa, how can I convert the time value converted by php in mysql?

The time converted by the php date function is stored in the mysql database.
1391768710
This represents February 7, 2014.
How can I get this time in mysql?
What time functions can be directly converted into time formats in mysql?
For example, if my field is begintime, the table name is tab_information.
------ Solution --------------------
Unix_timestamp
------ Solution --------------------
Select from_unixtime (1391768710)
18:25:10

Select from_unixtime (1391768710, '% Y-% m-% d ')
2014-02-07

------ Solution --------------------
From_unixtime (unix_timestramp, format.

Unix_timestramp () converts time to timestamp.
------ Solution --------------------
From_unixtime (); 1391952085 to 21:21:25
Unix_timestamp (); 21:21:25 to 1391952085

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.