dbTalk Databases Forums  

use function week

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss use function week in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Raymundo Betancourt
 
Posts: n/a

Default use function week - 11-21-2007 , 12:42 AM






I use function week but it always return incorrect week.

example

select week ('2007-01-01','2007-01-03') returns week 0 instead of week 1
select week ('2007-01-01','2007-01-08') returns week 1 instead of week 2

is there a bug in ASA.
I try in ASA version 6,9 and 10 with the same result
always returns a week -1.



Reply With Quote
  #2  
Old   
Arthur Hefti
 
Posts: n/a

Default Re: use function week - 11-21-2007 , 01:16 AM






In my understanding the function weeks works fine. It returns the number
of weeks (of 7 days) between the two dates.
This is in difference to datediff( week,.... ) which returns the number
of Sundays between the two dates including the second date but not the
first.

Regards
Arthur

Raymundo Betancourt wrote:
Quote:
I use function week but it always return incorrect week.

example

select week ('2007-01-01','2007-01-03') returns week 0 instead of week 1
select week ('2007-01-01','2007-01-08') returns week 1 instead of week 2

is there a bug in ASA.
I try in ASA version 6,9 and 10 with the same result
always returns a week -1.



Reply With Quote
  #3  
Old   
Richard Biffl
 
Posts: n/a

Default Re: use function week - 11-21-2007 , 01:18 AM



The WEEKS function returns the number of Sundays between two dates. The
results you get from ASA are correct. If you want different results, you may
need to write your own function.

Richard


"Raymundo Betancourt" <rbetancourt (AT) csnetbc (DOT) com> wrote

Quote:
I use function week but it always return incorrect week.

example

select week ('2007-01-01','2007-01-03') returns week 0 instead of week 1
select week ('2007-01-01','2007-01-08') returns week 1 instead of week 2

is there a bug in ASA.
I try in ASA version 6,9 and 10 with the same result
always returns a week -1.





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.