LoginSignup
1
0

More than 5 years have passed since last update.

【PHP】任意の時刻を操作する(ふるいやり方)

Last updated at Posted at 2018-04-25
$time = "10:00:00";

# int型に変換
$tm = strtotime($time);

# 30分すすめる
date("H:i:s", $tm+(60*30));

# 結果
10:30:00

ポイント

""で囲んで設定した$time時刻はstr型なので、strtotimeでint型(unixタイムスタンプ)に変換します。
すると、時刻を秒で扱えるようになるので、たとえば30分進めたいなら60秒/分*30分を足してください。

1
0
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
1
0