Based on Gregorain calendar, every week of a year has a number from 1 to 52, 53 or 54. Use this tag for instance if you want to calculate the weeknumber from a certain date or vice versa. You also might include the date tag. This tag is independent of programming language.
Questions tagged [week-number]
603 questions
4
votes
2 answers
Mongodb $week and Java Calendar.WEEK_OF_YEAR
Mongodb's $week operator states
Takes a date and returns the week of the year as a number between 0 and 53.
Weeks begin on Sundays, and week 1 begins with the first Sunday of the year. Days
preceding the first Sunday of the year are in week 0.…

Nasir
- 2,984
- 30
- 34
4
votes
2 answers
How can I get the week number considering Sunday as the start day?
$date = 'some date';
$todays_week = date('W',strtotime($date));
This code gives me the week number considering Monday as the first day of the week. I want to get the week number considering Sunday as the starting day of week. How do I do that?

Hriju
- 728
- 1
- 16
- 27
4
votes
1 answer
Mysql need to COUNT inscription per week lasts 12 weeks
I already count inscriptions, this week.
But i need to count inscription per week last 12 weeks, and send it in an array.
My actual request is :
SELECT COUNT(*) FROM PERSON
YEAR(date_inscription) = YEAR(NOW())
AND WEEK(date_inscription) =…

kesm0
- 847
- 1
- 11
- 20
4
votes
1 answer
Changing start-date in MySQL for week
I found the following code to help in creating a weekly report based on a start date of Friday. The instructions say to replace ".$startWeekDay." with a 4. When I put '".$startDay."' as '2013-01-30', I get errors.
Also I get a report by day rather…

megv
- 1,421
- 5
- 24
- 36
4
votes
4 answers
Calculate week numbers in matlab
I have an annual time series where measurements are recorded at hourly intervals:
StartDate = '2011-01-01 00:00';
EndDate = '2011-12-031 23:00';
DateTime=datevec(datenum(StartDate,'yyyy-mm-dd HH:MM'):60/(60*24):...
datenum(EndDate,'yyyy-mm-dd…

KatyB
- 3,920
- 7
- 42
- 72
3
votes
5 answers
Why are SQL Server week numbers different to Java week numbers?
I'm working on a reporting system using Java 6 and SQL Server 2008. For some queries I want to look at the data by week number. I'm using Java to fill in gaps in the the data to make a continuous time line and I have found that
java.util.Calendar…

jafwatt
- 323
- 4
- 19
3
votes
3 answers
to_date gives null on format yyyyww (202001 and 202053)
I have a dataframe with a yearweek column that I want to convert to a date. The code I wrote seems to work for every week except for week '202001' and '202053', example:
df = spark.createDataFrame([
(1, "202001"),
(2, "202002"),
(3, "202003"),…

Ceeeees
- 43
- 6
3
votes
1 answer
Convert Week of the Year to Date in PySpark
I have a PySpark dataframe with 'Week_of_the_year' column. '202005' means 5th week of year 2020.
How can I convert it to 'date' format, maybe convert to mid-date (Wednesday) of that week?
Example: I want '202005' to show as '2020-01-29'.

borderline_coder
- 183
- 1
- 13
3
votes
4 answers
Java LocalDate How to get last week of year as 53rd week instead of 1st week of new year?
If you consider that week will start from Jan 01 of every year & week start is SUNDAY then there will be 53 weeks in 2019.
Following above Jan 29,30,31 2019 will be into Week-53 of 2019.
As given in documentation of IsoFields for…

AshwinK
- 1,039
- 1
- 12
- 31
3
votes
2 answers
How to get successive week number and year in java?
I am storing some data referenced with the week number. Now, I have two button to request for data. One for previous week and the another for the next week.And data for current week is fetched by defaultI just finished making exceptions for the year…

Ebenezer Isaac
- 772
- 1
- 8
- 31
3
votes
0 answers
Get ISO year week in Apache Spark using scala / from_unixtime behaving differently in Spark and Hive
I am trying to get ISO year week in Spark with scala from a date which is in string format.
The following SQL query returns the expected result in hive.
i.e if the date is 1st January 2016, as per ISO standard it is 53rd week of year 2015 and hence…

Pravin Singh
- 79
- 7
3
votes
2 answers
How to get the week number, start date and end date of Compelete year in SQL Server?
How to get the complete week number, startdate and enddate of complete year.
Note
Week starts from Sunday to Saturday
at the same time week no 1 (ex: 01-01-2020 to 04-01-2020) and last week should be (ex:27-12-2020 to 31-12-2020)
Expecting…

Liam neesan
- 2,282
- 6
- 33
- 72
3
votes
1 answer
How to declare a time series of weekly data?
I have a question regarding declaring my dataset as a time series. I have weekly historical data of demand of a certain product. Every week is labeled as 201401, 201402, up to the current month 201937.
The problem arises once I declare the set as …

T Goose
- 31
- 6
3
votes
4 answers
How Can I get days of an specific Week in PHP?
Possible Duplicate:
Calculating days of week given a week number
In PHP you can get the number of week with 'date('W');' and it will return ISO-8601 week number of year
Now how I can get the days of an specific week and the month(s)…
user529649
3
votes
1 answer
how to show 0 for week when no record is matching that week in $week mongodb query
My collection looks like below with details
/* 1 createdAt:6/13/2018, 5:17:07 PM*/
{ "_id" : ObjectId("5b21043b18f3bc7c0be3414c"),
"Number" : 242,
"State" : "2",
"City" : "3",
"Website" : "",
"Contact_Person_Name" :…

charan tej
- 1,054
- 10
- 29