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

The solution to the number of query time in mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article will explain in detail about mysql query time out of the number of solutions, Xiaobian feel quite practical, so share with you as a reference, I hope you can read this article after some harvest.

mysql query time out of the number of solutions: first query the digital time from the database; then in the front end through the "function timestamp ToTime (timestamp){...} The "method converts the timestamp to time.

The database query time is displayed as a string of numbers at the front?

Solution:

There was a problem earlier, and the time query from the database was displayed as a number at the front. The database I use is mysql. My solution is to convert it at the front end. The code is as follows:

The string of numbers that came out of the query was a timestamp. All that was needed was to convert the timestamp into time at the foreground.

function timestampToTime(timestamp) { var date = new Date(timestamp);//*1000 for 10-bit timestamp, not multiplied by 1000 for 13-bit timestamp Y = date.getFullYear() + '/'; M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '/'; D = date.getDate() + ' '; h = date.getHours() + ':'; m = date.getMinutes() + ':'; s = date.getSeconds(); return Y+M+D; }

What needs to be noted is whether the query timestamp is 10 digits or 13 digits!!

About mysql query time out of the number of solutions to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

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