Answer the question
In order to leave comments, you need to log in
How to get the week number of the year in php and mysql?
Hello.
I made a weekly schedule not long ago.
It was necessary to calculate the first week and the final week in the selected period
. I did it like this in PHP
$date_start = strtotime("2018-05-03"); // тут может преобразование отличаться
$week_start=date("W", $date_start);
SELECT `date_invoice` ,WEEK(date_invoice) as week_num FROM `invoce` WHERE `date_invoice` BETWEEN '2018-05-01' AND '2018-05-31'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question