[pgsql-jp: 25666] Re: time型データの表示

koumei2 @ 104.net koumei2 @ 104.net
2002年 4月 23日 (火) 15:39:04 JST


ささきです。

On Tue, 23 Apr 2002 15:15:45 +0900
Takao Kato <sirius @ jp.fujitsu.com> wrote:

> > id	day		start
> > ------------------------------
> > 10	2002年4月23日	10時30分
> > 
> > select id, to_char(day,'YYYY年MM月DD日') as day, 
> > to_char(start,'HH24時MI分') as start from hoge where id=10 ;
> > とエラーになってしまいます。
> > ERROR: Function 'to_char(time, unknown)' does not exist
> >        Unable to identify a function that satisfies the given argument types
> >        You may need to add explicit typecasts
> > 	
> 
> かなりあこぎな方法だと思いますが、
> 
> # select id,to_char(day::timestamp,'YYYY年MM月DD日') as day,
>  # substr(start,1,2) || '時' || substr(start,4,2) || '分' as start
>  # from hoge where id = 10;

同じくかなりあこぎですが、、、
select id, 
       to_char(day,'YYYY年MM月DD日') as day,
       to_char(timestamp(day,start),'HH24時MI分') as start
from hoge where id=10;

とか。
# DATE は普通に to_char できますよね?


 --
koumei2 @ 104.net




pgsql-jp メーリングリストの案内