MYSQL timestamp problems

Source: Internet
Author: User
The problem with timestamp and MYSQL is as follows. My database stores the timestamp. how can I obtain the timestamp's date and time directly using MYSQL statements? You do not need to use the following methods: foreach ($ dataas $ k = & gt; $ v) {& nbsp; $ data [$ k] ['about timestamp and MYSQL
Yes. The timestamp is stored in my database.
How can I obtain the date and time of this timestamp through MYSQL statements?
The following method is not required:
Foreach ($ data as $ k => $ v ){
$ Data [$ k] ['Time'] = date ('Y-m-d H: I: S', $ v ['Time']);
}

------ Solution --------------------
SELECT FROM_UNIXTIME (1234567890, '% Y-% m-% d % H: % I: % S ')
------ Solution --------------------
SQL code
SELECT FROM_UNIXTIME ('time') as 'time' FROM tablename;

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.