In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to convert the timestamp into a general time format in MYSQL. I think it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.
How to convert MYSQL timestamps to general time format
UNIX_TIMESTAMP (date)
If there is no argument call, returns a Unix timestamp (seconds from '1970-01-01 00:00:00'GMT). If UNIX_TIMESTAMP () is called with a date parameter, it returns the second value from' 1970-01-01 00:00:00'GMT. Date can be a DATE string, a DATETIME string, a TIMESTAMP, or a number of local time in YYMMDD or YYYYMMDD format. Www.2cto.com
> select UNIX_TIMESTAMP ()
-> 882226357
Mysql > select UNIX_TIMESTAMP ('1997-10-04 22 purge 23purl 00')
-> 875996580
When UNIX_TIMESTAMP is used for a TIMESTAMP column, the function accepts the value directly, with no implicit "string-to-unix-timestamp" transformation.
Www.2cto.com
FROM_UNIXTIME (unix_timestamp)
Returns the value represented by the unix_timestamp parameter in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.
Mysql > select FROM_UNIXTIME (875996580)
-> '1997-10-04 22 22 purl 2300'
Mysql > select FROM_UNIXTIME (875996580) + 0
-> 19971004222300
FROM_UNIXTIME (unix_timestamp,format)
Returns a string representing the Unix time stamp, formatted according to the format string. Format can contain the same modifiers as the entries listed in the DATE_FORMAT () function.
Mysql > select FROM_UNIXTIME (UNIX_TIMESTAMP ()
'y D M h:%i:%s x')
-> '1997 23rd December 03:43:30 x'
The above is how to convert the timestamp into a general time format in MYSQL. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.