From_unixtime and Unix_timestamp differences in MySQL

Source: Internet
Author: User
Tags local time

Check official documents:

 FROM_UNIXTIME(unix_timestamp)FROM_UNIXTIME(unix_timestamp,format)

Returns A representation of theunix_timestampargument as a value in‘YYYY-MM-DD HH:MM:SS‘orYYYYMMDDHHMMSSformat, depending on whether the function was used in a string or numeric context. The value is expressed in the current time zone. unix_timestampis a internal timestamp value such as is produced by theUNIX_TIMESTAMP()function.

Description From_unixtime Returns the Unix_timestamp value only in the form specified by the current time zone.

  unix_timestamp () ,   unix_timestamp ( date )

if called with no argument, returns a Unix timestamp (seconds since  ' 1970-01-01 00:00:00 '  UTC) as An unsigned integer. if  unix_timestamp ()  is called with a  date  argument, it Returns the value of the argument as seconds since  ' 1970-01-01 00:00:00 '  utc.  Date  may be a  date  string, a  DATETIME  string, a   TIMESTAMP , or a number in the format  YYMMDD  or  YYYYMMDD . The server interprets  date  as A value in the current time zone and converts it to an inter NAL value in UTC

Different points in and, Unix_timestamp will be affected by the local time zone, it is possible that 2 different timstamp corresponds to one unixtimestamp, while From_unixtime is one by one corresponding


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.