List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 29 1999 12:39am
Subject:Re: About ISO week # formatting in MySQL
View as plain text  
>>>>> "Peter" == =?ISO-8859-1?Q?Peter Str=F6mberg?= <ISO-8859-1>
> writes:

Peter> Den 28 Sep 99, klockan 18:09
Peter> skrev Matthias Urlichs om (Re: About ISO week # formatting in ):

>> Hi,
>> 
>> Peter Strömberg:
>> > Well, I would prefer that week('1982-01-01',1) should return the same value
>> > as week('1981-12-31',1) because they belong to the same week (which is 53)
>> > 
>> Hmm, yes, but then you can't reasonably sort by the week number any more.

Peter> How to differ week 52 in the begining of a year and week 52 at the end of a
> year?

Peter> Maybe a new function, yearweek() who returns year of week and week:

Peter> yearweek('1981-12-31',1) = 198153
Peter> yearweek('1982-01-01',1) = 198153
Peter> yearweek('1982-12-31',1) = 198252
Peter> yearweek('1983-01-01',1) = 198252

Peter> compared to:

Peter> week('1981-12-31',1) = 53
Peter> week('1982-01-01',1) = 0
Peter> week('1982-12-31',1) = 52
Peter> week('1983-01-01',1) = 0

Peter> Then one could use yearweek() to sort data which is in different years.

Hi!

Yes, the right way to fix this is to introduce a new function.

(The problem is that WEEK() in ODBC is defined to only return the week 
number, so we can't fix the WEEK() function)

I shall put this on your TODO.

Regards,
Monty

Thread
About ISO week # formatting in MySQLJuan Riera26 Sep
  • About ISO week # formatting in MySQLMichael Widenius26 Sep
  • RE: About ISO week # formatting in MySQLJuan Riera27 Sep
    • RE: About ISO week # formatting in MySQLAldrian Gintingsuka27 Sep
    • RE: About ISO week # formatting in MySQLMichael Widenius27 Sep
      • RE: About ISO week # formatting in MySQLbkline28 Sep
        • RE: About ISO week # formatting in MySQLPeter Strömberg28 Sep
      • Re: About ISO week # formatting in MySQLMartin Ramsch28 Sep
        • Re: About ISO week # formatting in MySQLPeter Strömberg28 Sep
          • Re: About ISO week # formatting in MySQLAldrian Gintingsuka28 Sep
            • Re: About ISO week # formatting in MySQLMartin Ramsch28 Sep
            • Re: About ISO week # formatting in MySQLBob Kline28 Sep
          • Re: About ISO week # formatting in MySQLMatthias Urlichs28 Sep
            • Re: About ISO week # formatting in MySQLPeter Strömberg28 Sep
              • Re: About ISO week # formatting in MySQLMichael Widenius29 Sep
            • Re: About ISO week # formatting in MySQLBob Kline28 Sep
              • Re: About ISO week # formatting in MySQLMatthias Urlichs29 Sep
          • RE: About ISO week # formatting in MySQLJuan Riera30 Sep
            • Re: About ISO week # formatting in MySQLMartin Ramsch30 Sep
        • Re: About ISO week # formatting in MySQLMartin Ramsch28 Sep
          • Re: About ISO week # formatting in MySQLBob Kline28 Sep
            • Re: About ISO week # formatting in MySQLMartin Ramsch28 Sep
              • Re: About ISO week # formatting in MySQLBob Kline28 Sep
                • Re: About ISO week # formatting in MySQLMartin Ramsch28 Sep
                  • Re: About ISO week # formatting in MySQLBob Kline29 Sep
                • Re: About ISO week # formatting in MySQLMartin Ramsch29 Sep