In the meantime, this function will generate week numbers consistent with
ISO8601.
create procedure DB.DBA.ISOweek( IN targetDate datetime ) RETURNS integer
{
declare week, ISOweekdaynum integer;
-- ISO8601 is Monday based, Virtuoso is Sunday based
ISOweekdaynum := dayofweek(targetDate)-1;
-- source: http://en.wikipedia.org/wiki/ISO_week_date#Calculation
week := floor((dayofyear(targetDate) - ISOweekdaynum +10)/7);
return week;
}
On 18 September 2013 16:47, Quentin <quent...@clearbluewater.com.au> wrote:
> There are multiple standards for defining calendar weeks though ISO8601
> though most would have the 2013-01-01 in week one that ends on 6th
> January. We use ISO8601 generally and it's pretty common (<
> http://en.wikipedia.org/wiki/ISO_8601#Week_dates>).
>
> There's unfortunately no information available about Virtuoso's
> implementation: <http://docs.openlinksw.com/virtuoso/fn_week.html>.
>
> Some experimentation shows the following results:
> select
> bif:week(xsd:datetime('2013-01-01T00:00:00Z')) as ?1stAsWeek
> bif:dayname(xsd:datetime('2013-01-01T00:00:00Z')) as ?1stAsDay
> bif:week(xsd:datetime('2013-01-07T00:00:00Z')) as ?7thAsWeek
> bif:dayname(xsd:datetime('2013-01-07T00:00:00Z')) as ?7thAsDay
> bif:week(xsd:datetime('2013-01-08T00:00:00Z')) as ?8thAsWeek
> bif:dayname(xsd:datetime('2013-01-08T00:00:00Z')) as ?8thAsDay
> {} 1stAsWeek 1stAsDay 7thAsWeek 7thAsDay 8thAsWeek 8thAsDay 1 Tuesday 1
> Monday 2 Tuesday
> It seems like this is just counting weeks from the 1st/Jan and counting a
> new week every seven days after that. Are there any plans to provide more
> standardised usage of calendar weeks?
>
> --
> Quentin | Clear Blue Water Pty Ltd
> quent...@clearbluewater.com.au
>
--
Quentin | Clear Blue Water Pty Ltd
quent...@clearbluewater.com.au
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users