week-number

gnuplot: How to get correct week numbers?

只谈情不闲聊 提交于 2021-01-20 04:45:41
问题 Originating from this question gnuplot why warning: Bad time format in string, there was the finding that the week numbers in gnuplot using the time specifiers %W and %U are wrong in some cases. Apparently, there are different definitions of the week numbers. Furthermore, there are different definitions when a week starts, e.g. on Sunday or Monday. One definition for week numbers, which is commonly used (however, not in the US and a few other countries) is according to ISO 8601. Code: (to

Convert date to ISO week date

吃可爱长大的小学妹 提交于 2020-04-16 05:47:14
问题 How to convert dates to ISO week date in Impala SQL? For example 2019-12-30 in the ISO week date calendar would be written as 2020-W01-1 or 2020W011 ANSWER: Marked Gordon Linoff answer as correct, as it solves the essential part of the question, the deducing of the year part of ISO week date. For the week part of the ISO week date there is a ready function, and the day part of the ISO week date can be easily converted from Sunday starting week to Monday starting week. The query below contains

ISO week number in VBScript or VBA

↘锁芯ラ 提交于 2020-02-24 11:29:27
问题 How can I get the ISO week number of some date in VBScript or VBA? 回答1: First, note that: It is important to report the week year along with the week number, as the date's year could be different. Several Windows components contain a bug for some years' last Monday. In my experience the simplest, clearest and most robust way to compute this is: Sub WeekNum(someDate, isoWeekYear, isoWeekNumber, isoWeekDay) Dim nearestThursday isoWeekDay = WeekDay(someDate, vbMonday) nearestThursday = DateAdd(

PostgreSQL custom week number - first week containing Feb 1st

无人久伴 提交于 2020-01-24 09:51:31
问题 I'm new to SQL functions and trying to create a calendar table that displays custom week numbers, with each week starting with Saturday and ending on Friday. The first week of each year always contains Feb.1st of that year. For example, if the day of the week of Feb. 1st for a particular year is Tuesday, then the first week for that year is from Jan. 29 to Feb. 4 . I've been struggling with this problem for a couple days and the only solution I can come up with is as follows: First, I created

PostgreSQL custom week number - first week containing Feb 1st

时光怂恿深爱的人放手 提交于 2020-01-24 09:51:04
问题 I'm new to SQL functions and trying to create a calendar table that displays custom week numbers, with each week starting with Saturday and ending on Friday. The first week of each year always contains Feb.1st of that year. For example, if the day of the week of Feb. 1st for a particular year is Tuesday, then the first week for that year is from Jan. 29 to Feb. 4 . I've been struggling with this problem for a couple days and the only solution I can come up with is as follows: First, I created

Given an ISO 8601 week number, get date of first day of that week in LibreOffice Calc spreadsheet

被刻印的时光 ゝ 提交于 2020-01-24 08:47:08
问题 LibreOffice Calc spreadsheet offers a function ISOWEEKNUM to return the standard ISO 8601 week number of the specified date. I want the opposite. ➠ Given a standard week number, give me the date of the first day of that week (the Monday date). Passing integers is acceptable. Also nice if able to pass a string in standard format. Like this: DATE_OF_ISOWEEKNUM( 2017 , 42 ) ➝ date of Monday of week 42 in week-based year 2017 DATE_OF_ISOWEEKNUM( "2017-W42" ) ➝ date of Monday of week 42 in week

Getting week number of date in SQL

自作多情 提交于 2020-01-11 11:45:10
问题 Is there a way to get the week number of a date with SQL that is database independent? For example to get the month of a date I use: SELECT EXTRACT(MONTH FROM :DATE) But the EXTRACT function doesn't know about weeks in SQL92. Please pay attention to the fact that I want a solution that is database independent ! Do not misinterpret this as a question regarding MS SQL Server. 回答1: There doesn't appear to be a single standard SQL function to extract the week number from a date - see here for a

Not converting yearweek function with QueryDSL

烈酒焚心 提交于 2020-01-07 08:35:13
问题 I would like to use the yearweek() function of QueryDSL, which is supported by QueryDSL. This function generates the query select year(table1.timestamp)*100 + week(table1.timestamp) as col_0_0_ [...] . This does, however, not return a correct result on year endings. I've already opened a bug report for this issue. I would rather use the built-in SQL yearweek() function, which is directly supported by e.g. MariaDB. Is there a way of using the SQL function YEARWEEK(timestamp) with QueryDSL? Or

Date get week number for custom week start day

时间秒杀一切 提交于 2020-01-05 03:03:26
问题 How should the getWeekNumber() prototype should be changed for Date class if I have a custom week start day instead of Monday. Current code for finding ISO Week Number: Date.prototype.getWeekNumber = function() { // Create a copy of this date object var target = new Date(this.valueOf()); // ISO week date weeks start on monday // so correct the day number var dayNr = (this.getDay() + 6) % 7; // ISO 8601 states that week 1 is the week // with the first thursday of that year. // Set the target

algorithm for calculating a week # from a date with custom start of week? (for iCal)

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 02:40:47
问题 I can only find algorithm for getting ISO 8601 week (week starts on a Monday). However, the iCal spec says A week is defined as a seven day period, starting on the day of the week defined to be the week start (see WKST). Week number one of the calendar year is the first week that contains at least four (4) days in that calendar year. Therefore, it is more complex than ISO 8601 since the start of week can be any day of the week. Is there an algorithm to determine what is the week number of a