Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 4 of 4 total |
Possible bug or issue with Week function |
Tue, Feb 11 2014 7:20 AM | Permanent Link |
Adam Brett Orixa Systems | If each of the following sql snipets are run:
CREATE TABLE Test (DateDone Date); INSERT INTO Test (DateDone) VALUES (DATE '2013-12-31'); SELECT EXTRACT(WEEK FROM DateDone) FROM Test; -- The SELECT returns "1" (on computers on my network anyway) I believe the select should return 52 (the final week of the year)?? Is this an EDB BUG, or have I made a stupid mistake? |
Tue, Feb 11 2014 7:26 AM | Permanent Link |
Adam Brett Orixa Systems | I am using EDB 2.13.
I can see that 2013-12-28 returns week 52, 2013-12-29 2013-12-30 2013-12-31 all return week "1", but year 2013. Surely these dates should either be week 53, or week 52. Otherwise, sums using these week numbers end up in figures for January of that year. |
Tue, Feb 11 2014 10:00 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Adam,
<< I believe the select should return 52 (the final week of the year)?? Is this an EDB BUG, or have I made a stupid mistake? >> From the manual: "All day and week values returned from EXTRACT follow the ISO 8601 standard for day and week numbers." http://stackoverflow.com/questions/274861/how-do-i-calculate-the-week-number-given-a-date Specifically (from the answers): "ISO 8601 defines a standard for the representation of dates, times and time zones. It defines weeks that start on a Monday. It also says Week 1 of a year is the one which contains at least 4 days from the given year. Consequently, the 29th, 30th and 31st of December 20xx could be in week 1 of 20xy (where xy = xx + 1), and the 1st, 2nd and 3rd of January 20xy could all be in the last week of 20xx. Further, there can be a week 53." Tim Young Elevate Software www.elevatesoft.com |
Wed, Feb 12 2014 4:05 AM | Permanent Link |
Adam Brett Orixa Systems | >>"All day and week values returned from EXTRACT follow the ISO 8601 standard
>>for day and week numbers." Always with the ISO Standards ... |
This web page was last updated on Friday, September 20, 2024 at 05:39 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |