Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql date function

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

SELECT NOW (); # return current system date + time SELECT CURDATE (); # return current system date, no time SELECT CURTIME (); # return current system time, excluding date SELECT YEAR (NOW ()); # return year SELECT YEAR (CURDATE ()); # return year SELECT YEAR ('1999-1-1'); # return year SELECT MONTH (NOW ()); # return month SELECT MONTHNAME (NOW ()) # return the English name of the current month SELECT DAY (NOW ()); # return date SELECT HOUR (NOW ()); # return SELECT MINUTE (NOW ()); # return sub-SELECT SECOND (NOW ()); # return second SELECT STR_TO_DATE ('1999-1-1 minutes)% Ymi% mMak% d') # parsing time according to string format # case: query employee information SELECT * FROM employees WHERE hiredate='1992-4-3 employee select * FROM employees WHERE hiredate= STR_TO_DATE ('4-3-1992); SELECT DATE_FORMAT (NOW (),'% y% m / d') AS out_put # parse the date into a string format # case: query the employee name and entry date (month / day year) SELECT last_name, DATE_FORMAT (hiredate,'%m month /% d% Y year') FROM employeesWHERE commission_pct > 0

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report