DateTime fields, methods over such fields, DateTime depended SQL where-clause and SQL-functions.

Claudius Sailer Claudius at sailer-online.de
Thu Dec 9 19:46:25 CST 2004


Hi Ivan,
Hi Ruslan,


Am 09. Dez 2004 um 19:27 Uhr schrieb Ivan Smahin:

> I see. So for making week function more flexible we add third optional 
> param
> to this sql-function - minimalDaysInFirstWeek.
>
> So, now it seems like:
>
> Week( date, [firstWeekDay], [minimalDaysInFirstWeek] )
>
> where
> minimalDaysInFirstWeek must be in range 1-7
> (1 by default - "US calendar" - XXXX-01-01 is always first week)
>
>
> Some examples:
>
> SELECT week('2005-01-01')
> SELECT week('2005-01-01', 0)
> SELECT week('2005-01-01', 1)
> SELECT week('2005-01-01', 2)
> SELECT week('2005-01-01', 3)
> SELECT week('2005-01-01', 4)
> SELECT week('2005-01-01', 5)
> SELECT week('2005-01-01', 6)


I checked this function against my critical few test-dates and 
FANTASTIC you had implemented calculation by DIN and not US-Style. For 
me I don't need 3rd value, but I am not sure what US-Users need!!!!!!


> SELECT week('2005-01-01', 2, 3)
> SELECT week('2005-01-01', 3, 3)
> SELECT week('2005-01-01', 4, 3)
> SELECT week('2005-01-01', 5, 3)
> SELECT week('2005-01-01', 6, 3)
>
> All these queries produce 1 as result.
> In other words, you get first week  for 01.01,XXXX.
>
> ----------------
>
> SELECT week('2005-01-01', 0, 3)
> SELECT week('2005-01-01', 1, 3)
>
> But this queries produce 53 as result.

I think your third parameter will help US-Users, but I can life with 2. 
It is now yours decission :-))

MANY THANKS

bye


Claudius



More information about the Valentina-beta mailing list