Skip to Content

How to use Week function in HANA but with different day as Start of the Week?

Hi All,

We have the WEEK Function in HANA and it computes the week number.

Can we know which Day of the week it takes as reference as start_of_the_week

But is there a way where we can pass or set a parameter for the start_day_of_the_week?

For example consider the date 2nd Jan 2017

select WEEK(TO_DATE('20170102','YYYYMMDD')) from dummy
2

if we consider Monday as the "start_of_the_week" then the output is 2 also its the same when we run in HANA SQL.

but if Sunday is the "start_of_the_week" then the output expected is 1.

As per business needs the start_of_the_week needs to be "Sunday" or any other day,

Is there a way to achieve this using raw SQL?

Regards,

Kiran Shenvi

Regards,

Kiran

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Dec 01, 2017 at 12:17 AM

    Hi Kiran,

    Any luck?? we are facing the same issue.

    Add comment
    10|10000 characters needed characters exceeded