1024programmer Mysql How does mysql convert timestamp to date

How does mysql convert timestamp to date

mysql method to convert timestamp into date: use the function [FROM_UNIXTIME()], the code is [select FROM_UNIXTIME(1429063399, & # 39; %Y year %m month %d day & # 39;) 】.

Mysql converts timestamp to date:

1. Convert timestamp to date

Function: FROM_UNIXTIME()

select FROM_UNIXTIME(1429063399,'%YYear%mMonth%dDay&#39  ;)

The result is: April 15, 2015

2. Convert the date to a timestamp, which is exactly the opposite of FROM_UNIXTIME

Function: UNIX_TIMESTAMP()

select UNIX_TIMESTAMP('2015-04-15')

The result is: 1429027200

Related free learning recommendation: mysql database (video)

The above is the detailed content of how mysql converts timestamps into dates. For more information, please pay attention to other related articles on 1024programmer.com !

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-does-mysql-convert-timestamp-to-date-2/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索