In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Take the current time:
Select current_timestamp
Output: 2016-06-16 16:12:52
Select now ()
Output: 2016-06-16 16:12:52
Take one minute before the current time:
Select SUBDATE (now (), interval 60 second)
Output: 2016-06-16 16:11:52
Take the next minute of the current time:
Select ADDDATE (now (), interval 60 second)
Output: 2016-06-16 16:13:52
By changing the units above. You can take the time of minutes, hours and days.
Take the time of the previous minute:
Select SUBDATE (now (), interval 1 minute)
Output: 2016-06-16 16:16:38
Take the time of the previous hour:
Select SUBDATE (now (), interval 1 hour)
Output: 2016-06-16 15:17:38
Take the time of the previous day:
Select SUBDATE (now (), interval 1 day)
Output: 2016-06-15 16:17:38
# #
One minute after taking:
Select ADDDATE (now (), interval 1 minute)
Output: 2016-06-16 16:17:38
One hour after taking:
Select ADDDATE (now (), interval 1 hour)
Output: 2016-06-16 17:17:38
Take the time of the day after:
Select ADDDATE (now (), interval 1 day)
Output: 2016-06-17 16:17:38
The following is a supplement:
Mysql gets yesterday's date, today's date, tomorrow's date, and the time of the previous hour and the next hour
1. Current date
Select DATE_SUB (curdate (), INTERVAL 0 DAY)
2. Tomorrow's date
Select DATE_SUB (curdate (), INTERVAL-1 DAY)
3. Yesterday's date
Select DATE_SUB (curdate (), INTERVAL 1 DAY)
4. The previous hour
Select date_sub (now (), interval 1 hour)
5. The next hour
Select date_sub (now (), interval-1 hour)
6. The first 30 minutes
Select date_add (now (), interval-30 minute)
7. The last 30 minutes
Select date_add (now (), interval 30 minute)
If you still don't have what you want, you can check out the relevant articles below. Thank you for your support.
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.