Function WEEK in Base

classic Classic list List threaded Threaded
6 messages Options
Harvey Nimmo Harvey Nimmo
Reply | Threaded
Open this post in threaded view
|

Function WEEK in Base

Does anyone know why the function WEEK returns a zero for Tuesday, Jan
1st, 2019? i.e. WEEK('19-01-01')

According to my calendar it should be week 1 and, in Calc, the WEEKNUM
and ISOWEEKNUM both return 1. (WEEKNUM starts the week on Sunday,
ISOWEEKNUM on Monday, but otherwise no difference)

Cheers
Harvey

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Robert Großkopf Robert Großkopf
Reply | Threaded
Open this post in threaded view
|

Re: Function WEEK in Base

Hi Harvey,

> Does anyone know why the function WEEK returns a zero for Tuesday, Jan
> 1st, 2019? i.e. WEEK('19-01-01')

Must be WEEK('2019-01-01'), if you are using the internal HSQLDB. Gives
'1' here.
Must be EXTRACT(WEEK FROM CAST('2019-01-01' AS TIMESTAMP)), if you are
using internal Firebird. Also the result is '1' here.
>
> According to my calendar it should be week 1 and, in Calc, the WEEKNUM
> and ISOWEEKNUM both return 1. (WEEKNUM starts the week on Sunday,
> ISOWEEKNUM on Monday, but otherwise no difference)

Regards

Robert
--
Homepage: http://robert.familiegrosskopf.de
LibreOffice Community: http://robert.familiegrosskopf.de/map_3


--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Harvey Nimmo Harvey Nimmo
Reply | Threaded
Open this post in threaded view
|

Re: Function WEEK in Base

On Sun, 2019-08-25 at 08:21 +0200, Robert Großkopf wrote:

> Hi Harvey,
>
> > Does anyone know why the function WEEK returns a zero for Tuesday,
> > Jan
> > 1st, 2019? i.e. WEEK('19-01-01')
>
> Must be WEEK('2019-01-01'), if you are using the internal HSQLDB.
> Gives
> '1' here.
> Must be EXTRACT(WEEK FROM CAST('2019-01-01' AS TIMESTAMP)), if you
> are
> using internal Firebird. Also the result is '1' here.
> >
> > According to my calendar it should be week 1 and, in Calc, the
> > WEEKNUM
> > and ISOWEEKNUM both return 1. (WEEKNUM starts the week on Sunday,
> > ISOWEEKNUM on Monday, but otherwise no difference)
>
> Regards
>
> Robert
> --
> Homepage: http://robert.familiegrosskopf.de
> LibreOffice Community: http://robert.familiegrosskopf.de/map_3

Hallo Robert,

I am using Mariadb10 as backend from a Base client via JDBC. I have
created the function within a Base Query (GUI).

Cheers
HArvey

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Harvey Nimmo Harvey Nimmo
Reply | Threaded
Open this post in threaded view
|

Re: Function WEEK in Base

On Sun, 2019-08-25 at 14:32 +0200, Harvey Nimmo wrote:

> On Sun, 2019-08-25 at 08:21 +0200, Robert Großkopf wrote:
> > Hi Harvey,
> >
> > > Does anyone know why the function WEEK returns a zero for
> > > Tuesday,
> > > Jan
> > > 1st, 2019? i.e. WEEK('19-01-01')
> >
> > Must be WEEK('2019-01-01'), if you are using the internal HSQLDB.
> > Gives
> > '1' here.
> > Must be EXTRACT(WEEK FROM CAST('2019-01-01' AS TIMESTAMP)), if you
> > are
> > using internal Firebird. Also the result is '1' here.
> > >
> > > According to my calendar it should be week 1 and, in Calc, the
> > > WEEKNUM
> > > and ISOWEEKNUM both return 1. (WEEKNUM starts the week on Sunday,
> > > ISOWEEKNUM on Monday, but otherwise no difference)
> >
> > Regards
> >
> > Robert
> > --
> > Homepage: http://robert.familiegrosskopf.de
> > LibreOffice Community: http://robert.familiegrosskopf.de/map_3
>
> Hallo Robert,
>
> I am using Mariadb10 as backend from a Base client via JDBC. I have
> created the function within a Base Query (GUI).
>
> Cheers
> HArvey

...and by the way, it makes no difference whether 2019-01-01 or 19-01-
01 the result is the same

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Robert Großkopf Robert Großkopf
Reply | Threaded
Open this post in threaded view
|

Re: Function WEEK in Base

In reply to this post by Harvey Nimmo
Hi Harvey,
>
> I am using Mariadb10 as backend from a Base client via JDBC. I have
> created the function within a Base Query (GUI).

So it isn't a LO-problem. WEEK gives (in MariaDB/MySQL) 0 - 53, if you
start the week with Sunday.
WEEK('2019-01-01',1) gives 1, because it returns values from 1 - 53.
See https://mariadb.com/kb/en/library/week/ for the right mode.

Regards

Robert
--
Homepage: http://robert.familiegrosskopf.de
LibreOffice Community: http://robert.familiegrosskopf.de/map_3


--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Harvey Nimmo Harvey Nimmo
Reply | Threaded
Open this post in threaded view
|

Re: Function WEEK in Base

On Sun, 2019-08-25 at 15:34 +0200, Robert Großkopf wrote:

> Hi Harvey,
> >
> > I am using Mariadb10 as backend from a Base client via JDBC. I have
> > created the function within a Base Query (GUI).
>
> So it isn't a LO-problem. WEEK gives (in MariaDB/MySQL) 0 - 53, if
> you
> start the week with Sunday.
> WEEK('2019-01-01',1) gives 1, because it returns values from 1 - 53.
> See https://mariadb.com/kb/en/library/week/ for the right mode.
>
> Regards
>
> Robert
> --
> Homepage: http://robert.familiegrosskopf.de
> LibreOffice Community: http://robert.familiegrosskopf.de/map_3
>
Terrific, Robert! That is what I needed to know!
Many thanks.

Harvey

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy