MySQL時間日付関数

580 ワード

  • 現在時刻now() current_timestamp() current_date() current_time() date_format(date, format)
  • select date_format(now(), "%Y-%m-%d %H:%i:%S"); 2019-05-23 11:20:14 select date_format(now(), "%Y-%m-%d %h:%i:%S %p");%H 24時間制2019-05-23 11:20:14 AM%h 12時間制、%pはAM/PMを表す.
  • dayof*(date)dayofyear(date)戻り1~3662dayofmonth(date)戻り1~31 dayofweek(date)戻り1~7(1は日曜日)weekday(date)戻り0~6(0は月)
  • .