日付・時間関数エポックタイムの取得SELECT extract(epoch from birth_day) FROM users; DATE型書式設定関数SELECT to_char(now(), 'YYYY-MM-DD HH24:MI:SS'); 精度の切り落としSELECT date_trunc('month', now()); # 結果:2009-06-01 00:00:00+09 部分フィールドの取得SELECT EXTRACT(MONTH FROM TIMESTAMP '2009-04-01 12:00:00'); TIMESTAMP型を文字列に変換SELECT to_char(now(), 'YYYY/MM/DD HH24:MI::SS'); http://www.postgresql.jp/document/pg833doc/html/functions-formatting.html 参考http://www.postgresql.jp/document/pg837doc/html/functions-datetime.html |
|