mysql:10619
From: 渡邊昌之 <渡邊昌之 <mark@xxxxxxxxxx>>
Date: Wed, 08 Dec 2004 13:40:48 +0900
Subject: [mysql 10619] Re: date_format がうまくできない
渡邊と申します。
%U 日曜日を週の最初の日とした場合の週(00..53)。
ってのは
その日がその年の第何週目かというのを返してくれる訳です。
で、手元の 結果を見てみましたが、なぜか質問の様にはならず
date_format('2001-01-01','%U %W') 00 Monday
date_format('2002-01-01','%U %W') 00 Tuesday
date_format('2003-01-01','%U %W') 00 Wednesday
date_format('2004-01-01','%U %W') 00 Thursday
date_format('2005-01-01','%U %W') 00 Saturday
date_format('2006-01-01','%U %W') 01 Sunday
date_format('2007-01-01','%U %W') 00 Monday
date_format('2008-01-01','%U %W') 00 Tuesday
date_format('2009-01-01','%U %W') 00 Thursday
date_format('2010-01-01','%U %W') 00 Friday
となりましたが
これだと、要するに1/1が日曜日だと、1/1は第1週で
1/1がそれ以外の曜日なら、1/1は第0週であると言っているわけです。
とりあえずそういう意味だと思います。
でもなんでその値になったんでしょう?
"si" <mfcatl2000@xxxxxxxxxx> wrote:
> mysql 3.23.55を使ってます。
>
> date_format を使うとき
> 返却値
> date_format("2011-01-01","%U") 00
> date_format("2010-01-01","%U") 00
> date_format("2009-01-01","%U") 00
> date_format("2008-01-01","%U") 01
> date_format("2007-01-01","%U") 01
> date_format("2006-01-01","%U") 01
> date_format("2005-01-01","%U") 00
> date_format("2004-01-01","%U") 00
> date_format("2003-01-01","%U") 01
> date_format("2002-01-01","%U") 01
> date_format("2001-01-01","%U") 01
>
> %Uは週の始まりのを日曜としたときのカウントですが
> 週の始まりを日曜としたときというのはどういうことでしょうか?
> また、返却値が法則がいまいちわかりません。
> よろしくおねがい、します。
>
>
> __________________________________
> STOP HIV/AIDS.
> Yahoo! JAPAN Redribbon Campaign
> http://pr.mail.yahoo.co.jp/redribbon/
>
>
_______________________________________
渡邊昌之
mark@xxxxxxxxxx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10618 2003-12-08 12:33 ["si" <mfcatl2000@xxx] date_format がうまくできない -> 10619 2004-12-08 13:40 ┣[渡邊昌之 <mark@xxxxx] 10622 2004-12-08 14:08 ┃┗["si" <mfcatl2000@xxx] 10627 2004-12-08 14:28 ┃ ┣[渡邊昌之 <mark@xxxxx] 10629 2004-12-08 14:55 ┃ ┃┣[渡邊昌之 <mark@xxxxx] 10630 2004-12-08 16:10 ┃ ┃┃┣["si" <mfcatl2000@xxx] 10631 2004-12-08 16:36 ┃ ┃┃┗[Youichi Iwakiri <yiw] 10633 2004-12-08 16:55 ┃ ┃┃ ┗["si" <mfcatl2000@xxx] 10634 2004-12-08 17:03 ┃ ┃┗[IWASAKI Dai <dai@xxx] 10632 2004-12-08 16:36 ┃ ┗[UNO Shintaro <uno@xx] 10620 2004-12-08 13:47 ┗[Daiju <d.is.here@xxx] 10621 2004-12-08 14:00 ┗["si" <mfcatl2000@xxx] 10623 2004-12-08 14:04 ┗[Daiju <d.is.here@xxx] 10624 2004-12-08 14:19 ┗["si" <mfcatl2000@xxx] 10626 2004-12-08 14:26 ┣[渡邊昌之 <mark@xxxxx] 10628 2004-12-08 14:34 ┗[Daiju <d.is.here@xxx]