PGSQLは今日、昨日のデータを調べて、一ヶ月以内のデータを実現します。


PGSQLは今日のデータを調べます。

select *
 from    as n
 where n.create_date>=current_date;
PGは昨日のデータを調べます。
方法1:

 select *
 from    as n
 where
    age(
    current_date,to_timestamp(substring(to_char(n.create_date, 'yyyy-MM-dd hh24 : MI : ss' ) FROM 1 FOR 10),'yyyy-MM-dd')) ='1 days';
方法2:

select *
 from    as n
 where n.create_date>=current_date-1 and n.create_date <current_date;
n.reat_dateはtimestampのデータです。
current_dateはpgsqlデータで、現在の日付を取得するフィールドです。
to_char(timestamp、text)はtimestampデータを文字列に変換します。
substring(text from int forint)は、希望のテキストフォーマット「yy-M-dd」を切り取ります。
to_timestamp(text、yyy-M-dd')をtimestamp形式に変換します。
ageは2つの時間の差を取ってdaysに戻ります。
PG検索の一番近い一ヶ月以内のデータ

select *
 from    as n
 and n.create_date>=to_timestamp(substring(to_char(now(),'yyyy-MM-dd hh24:MI:ss') FROM 1 FOR 10),'yyyy-MM-dd')- interval '30 day';
補足:postgresql現在の時間を調べます。
需要:PostgreSQLには現在の時間を取得する四つの方法があります。
ソリューション:
1.now()

戻り値:現在の年月日、時分秒、かつ秒は6桁の小数を保持します。
2.current_timestamp

戻り値:現在の年月日、時分秒、かつ秒は6桁の小数を保持します。同上
申明:nowとcurrent_timestampはほとんど違いません。戻り値は同じです。nowを使ってください。
3.current_時間

戻り値:時分秒、秒は最高6ビットまで正確です。
4.current_ダテ

戻り値:年月日
以上は個人の経験ですので、参考にしていただければと思います。間違いがあったり、完全に考えていないところがあれば、教えてください。