32
29

More than 5 years have passed since last update.

【MySQL】日時の計算(INTERVAL)

Posted at

--現在時刻から60秒前以降の値のものを抽出
select * from foo where modified < now() - interval 60 second;

--7日後を表示
select now() + interval 7 day;

構文

+(-) INTERVAL 数値 単位

単位として使えるもの

MICROSECOND
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH

32
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
29