How to group by week in MySQL?

You can use both YEAR(timestamp) and WEEK(timestamp), and use both of the these expressions in the SELECT and the GROUP BY clause. Not overly elegant, but functional… And of course you can combine these two date parts in a single expression as well, i.e. something like SELECT CONCAT(YEAR(timestamp), “https://stackoverflow.com/”, WEEK(timestamp)), etc… FROM … WHERE .. … Read more

How to get the day of week and the month of the year?

Yes, you’ll need arrays. var days = [‘Sunday’,’Monday’,’Tuesday’,’Wednesday’,’Thursday’,’Friday’,’Saturday’]; var months = [‘January’,’February’,’March’,’April’,’May’,’June’,’July’,’August’,’September’,’October’,’November’,’December’]; var day = days[ now.getDay() ]; var month = months[ now.getMonth() ]; Or you can use the date.js library. EDIT: If you’re going to use these frequently, you may want to extend Date.prototype for accessibility. (function() { var days = [‘Sunday’,’Monday’,’Tuesday’,’Wednesday’,’Thursday’,’Friday’,’Saturday’]; var months … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)