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

Takao Kato sirius @ jp.fujitsu.com
2002年 4月 23日 (火) 15:15:45 JST


 加藤@川崎です。
# 現実逃避 --;

> 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;

てのでは駄目ですか?もっとスマートな解は...お任せします > 有識者
# VIEW使うと多少綺麗かな ^^;
----
加藤@川崎
お便りは kato @ lantc.cs.fujitsu.co.jp まで



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